Struct cranelift_codegen_meta::cdsl::settings::SettingGroupBuilder
source · pub(crate) struct SettingGroupBuilder {
name: &'static str,
settings: Vec<ProtoSetting>,
presets: Vec<Preset>,
predicates: Vec<ProtoPredicate>,
}
Fields§
§name: &'static str
§settings: Vec<ProtoSetting>
§presets: Vec<Preset>
§predicates: Vec<ProtoPredicate>
Implementations§
source§impl SettingGroupBuilder
impl SettingGroupBuilder
pub fn new(name: &'static str) -> Self
fn add_setting(
&mut self,
name: &'static str,
description: &'static str,
comment: &'static str,
specific: ProtoSpecificSetting
)
pub fn add_bool(
&mut self,
name: &'static str,
description: &'static str,
comment: &'static str,
default: bool
) -> BoolSettingIndex
pub fn add_enum(
&mut self,
name: &'static str,
description: &'static str,
comment: &'static str,
values: Vec<&'static str>
)
pub fn add_num(
&mut self,
name: &'static str,
description: &'static str,
comment: &'static str,
default: u8
)
pub fn add_predicate(&mut self, name: &'static str, node: PredicateNode)
pub fn add_preset(
&mut self,
name: &'static str,
description: &'static str,
args: Vec<PresetType>
) -> PresetIndex
sourcepub fn build(self) -> SettingGroup
pub fn build(self) -> SettingGroup
Compute the layout of the byte vector used to represent this settings group.
The byte vector contains the following entries in order:
- Byte-sized settings like
NumSetting
andEnumSetting
. BoolSetting
settings.- Precomputed named predicates.
- Other numbered predicates, including parent predicates that need to be accessible by number.
Set self.settings_size
to the length of the byte vector prefix that
contains the settings. All bytes after that are computed, not
configured.
Set self.boolean_offset
to the beginning of the numbered predicates,
2. in the list above.
Assign byte_offset
and bit_offset
fields in all settings.