pub struct OverwriteBool { /* private fields */ }Expand description
A specialized optimized boolean overwrite modifier, with support of up to 32 boolean elements, to avoid allocations.
It is intended for just overwriting a possibly previous set value.
For example input_el.checked(true).checked(false) will set the checked attribute to false.
This will usually be used for boolean attributes such as input.checked, or button.disabled
If used for more than 32 it will panic.
Implementations§
Source§impl OverwriteBool
impl OverwriteBool
pub fn rebuild(&mut self, prev_len: u8)
Sourcepub fn push(this: &mut Modifier<'_, Self>, modifier: bool)
pub fn push(this: &mut Modifier<'_, Self>, modifier: bool)
Pushes modifier at the end of the current modifiers.
Must only be used when this.flags.was_created() == true.
Sourcepub fn mutate<R>(
this: &mut Modifier<'_, Self>,
f: impl FnOnce(&mut bool) -> R,
) -> R
pub fn mutate<R>( this: &mut Modifier<'_, Self>, f: impl FnOnce(&mut bool) -> R, ) -> R
Mutates the next modifier.
Must only be used when this.flags.was_created() == false.
Sourcepub fn skip(this: &mut Modifier<'_, Self>, count: u8)
pub fn skip(this: &mut Modifier<'_, Self>, count: u8)
Skips the next count modifiers.
Must only be used when this.flags.was_created() == false.
Sourcepub fn update(this: &mut Modifier<'_, Self>, prev: bool, next: bool)
pub fn update(this: &mut Modifier<'_, Self>, prev: bool, next: bool)
Updates the next modifier, based on the diff of prev and next.
It can also be used when the underlying element was recreated.
Sourcepub fn apply_changes(&mut self, f: impl FnOnce(Option<bool>))
pub fn apply_changes(&mut self, f: impl FnOnce(Option<bool>))
Applies potential changes with f.
Argument of f is the new value, Some(_) if set, and None if all values were deleted.