pub struct StyleAccess { /* private fields */ }Expand description
Batched style builder — collects declarations, flushes in ONE write on drop.
Like JavaScript’s element.style but batched: setting N properties
costs one lock acquisition, not N. Chrome does the same — style mutations
are batched within a microtask.
Implementations§
Source§impl StyleAccess
impl StyleAccess
pub fn display(&mut self, value: Display) -> &mut Self
pub fn color(&mut self, value: impl Into<AbsoluteColor>) -> &mut Self
pub fn background_color(&mut self, value: impl Into<AbsoluteColor>) -> &mut Self
pub fn width(&mut self, value: impl Into<Size>) -> &mut Self
pub fn height(&mut self, value: impl Into<Size>) -> &mut Self
pub fn min_width(&mut self, value: impl Into<Size>) -> &mut Self
pub fn min_height(&mut self, value: impl Into<Size>) -> &mut Self
pub fn margin_top(&mut self, value: impl Into<Margin>) -> &mut Self
pub fn margin_right(&mut self, value: impl Into<Margin>) -> &mut Self
pub fn margin_bottom(&mut self, value: impl Into<Margin>) -> &mut Self
pub fn margin_left(&mut self, value: impl Into<Margin>) -> &mut Self
pub fn margin(&mut self, value: impl Into<Margin>) -> &mut Self
pub fn padding_top( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn padding_right( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn padding_bottom( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn padding_left( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn padding( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn position(&mut self, value: PositionProperty) -> &mut Self
pub fn font_size(&mut self, value: FontSize) -> &mut Self
pub fn font_weight(&mut self, value: FontWeight) -> &mut Self
Sourcepub fn font_family(&mut self, name: &str) -> &mut Self
pub fn font_family(&mut self, name: &str) -> &mut Self
Set font-family from a name string (e.g., “Cairo”, “Roboto”).
Chrome equivalent: setting element.style.fontFamily.
Constructs a Stylo FontFamily with a single named family.
For multiple families or generics, use set_attribute("style", "font-family: ...").
pub fn opacity(&mut self, value: Opacity) -> &mut Self
pub fn flex_grow(&mut self, value: f32) -> &mut Self
pub fn flex_shrink(&mut self, value: f32) -> &mut Self
pub fn flex_basis(&mut self, value: impl Into<Size>) -> &mut Self
pub fn gap( &mut self, value: impl Into<NonNegativeLengthPercentage>, ) -> &mut Self
pub fn flex_direction(&mut self, value: T) -> &mut Self
pub fn flex_wrap(&mut self, value: T) -> &mut Self
pub fn align_items_center(&mut self) -> &mut Self
pub fn align_items_start(&mut self) -> &mut Self
pub fn align_items_end(&mut self) -> &mut Self
pub fn align_items_stretch(&mut self) -> &mut Self
pub fn justify_content_center(&mut self) -> &mut Self
pub fn justify_content_start(&mut self) -> &mut Self
pub fn justify_content_end(&mut self) -> &mut Self
pub fn justify_content_between(&mut self) -> &mut Self
pub fn border_radius( &mut self, v: impl Into<NonNegativeLengthPercentage> + Clone, ) -> &mut Self
pub fn border_width( &mut self, v: impl Into<NonNegativeLengthPercentage> + Clone, ) -> &mut Self
pub fn border_style(&mut self, v: BorderStyle) -> &mut Self
pub fn border_color(&mut self, v: impl Into<AbsoluteColor>) -> &mut Self
pub fn border_bottom_width_px(&mut self, v: f32) -> &mut Self
pub fn border_bottom_style(&mut self, v: BorderStyle) -> &mut Self
pub fn border_bottom_color(&mut self, v: impl Into<AbsoluteColor>) -> &mut Self
pub fn border_right_width_px(&mut self, v: f32) -> &mut Self
pub fn border_right_style(&mut self, v: BorderStyle) -> &mut Self
pub fn border_right_color(&mut self, v: impl Into<AbsoluteColor>) -> &mut Self
Sourcepub fn bg(&mut self, v: impl Into<AbsoluteColor>) -> &mut Self
pub fn bg(&mut self, v: impl Into<AbsoluteColor>) -> &mut Self
Short for background_color.
Sourcepub fn pad(&mut self, v: impl Into<NonNegativeLengthPercentage>) -> &mut Self
pub fn pad(&mut self, v: impl Into<NonNegativeLengthPercentage>) -> &mut Self
Short for padding (all 4).
pub fn raw(&mut self, decl: PropertyDeclaration) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StyleAccess
impl !RefUnwindSafe for StyleAccess
impl !Send for StyleAccess
impl !Sync for StyleAccess
impl Unpin for StyleAccess
impl UnsafeUnpin for StyleAccess
impl !UnwindSafe for StyleAccess
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert