pub type SingleSelectEntityMut<'a> = EntityMut<'a, SingleSelect>;
Expand description
Single-select variant of an EntityMut
.
Aliased Type§
struct SingleSelectEntityMut<'a> { /* private fields */ }
Implementations
source§impl<'a, SelectionMode: Default> EntityMut<'a, SelectionMode>where
Model<SelectionMode>: Selectable,
impl<'a, SelectionMode: Default> EntityMut<'a, SelectionMode>where
Model<SelectionMode>: Selectable,
sourcepub fn activate(self) -> Self
pub fn activate(self) -> Self
Activates the newly-inserted item.
ⓘ
model.insert().text("Item A").activate();
sourcepub fn secondary<Data>(
self,
map: &mut SecondaryMap<Entity, Data>,
data: Data,
) -> Self
pub fn secondary<Data>( self, map: &mut SecondaryMap<Entity, Data>, data: Data, ) -> Self
Associates extra data with an external secondary map.
The secondary map internally uses a Vec
, so should only be used for data that
is commonly associated.
ⓘ
let mut secondary_data = segmented_button::SecondaryMap::default();
model.insert().text("Item A").secondary(&mut secondary_data, String::new("custom data"));
sourcepub fn secondary_sparse<Data>(
self,
map: &mut SparseSecondaryMap<Entity, Data>,
data: Data,
) -> Self
pub fn secondary_sparse<Data>( self, map: &mut SparseSecondaryMap<Entity, Data>, data: Data, ) -> Self
Associates extra data with an external sparse secondary map.
Sparse maps internally use a HashMap
, for data that is sparsely associated.
ⓘ
let mut secondary_data = segmented_button::SparseSecondaryMap::default();
model.insert().text("Item A").secondary(&mut secondary_data, String::new("custom data"));
sourcepub fn data<Data: 'static>(self, data: Data) -> Self
pub fn data<Data: 'static>(self, data: Data) -> Self
Associates data with the item.
There may only be one data component per Rust type.
ⓘ
model.insert().text("Item A").data(String::from("custom string"));
pub fn divider_above(self, divider_above: bool) -> Self
sourcepub fn icon(self, icon: impl Into<Icon>) -> Self
pub fn icon(self, icon: impl Into<Icon>) -> Self
Define an icon for the item.
ⓘ
model.insert().text("Item A").icon(IconSource::from("icon-a"));
sourcepub fn id(self) -> Entity
pub fn id(self) -> Entity
Returns the ID of the item that was inserted.
ⓘ
let id = model.insert("Item A").id();
pub fn indent(self, indent: u16) -> Self
sourcepub fn position_swap(self, other: Entity) -> Self
pub fn position_swap(self, other: Entity) -> Self
Swap the position with another item in the model.