Skip to main content

ComputedStyle

Struct ComputedStyle 

Source
pub struct ComputedStyle {
Show 23 fields pub style: Style, pub relayout_boundary: bool, pub visuals: Option<Visuals>, pub text: Option<TextStyle>, pub opacity: Option<f32>, pub z_index: Option<i32>, pub interaction: Option<Interaction>, pub state_visuals: Option<StateVisuals>, pub transitions: Vec<TransitionSpec>, pub scrollbar: Option<ScrollbarStyle>, pub image_fit: Option<ImageFit>, pub input_paint: Option<TextInputPaint>, pub caret_width: Option<CaretWidth>, pub password_character: Option<PasswordCharacter>, pub caret_blink_ms: Option<u32>, pub track: Option<TrackStyle>, pub checkbox: Option<CheckboxStyle>, pub radio: Option<RadioStyle>, pub tab_button: Option<TabButtonStyle>, pub progress_chunk: Option<ProgressChunk>, pub popup_gap: Option<PopupGap>, pub knob_geometry: Option<KnobGeometry>, pub knob_fill: Color,
}
Expand description

Every style component one element carries, computed from its resolved attributes. None is a component it does not carry.

Fields§

§style: Style

Layout.

§relayout_boundary: bool

Whether layout may stop its dirty walk at this element.

§visuals: Option<Visuals>

Paint.

§text: Option<TextStyle>

Text.

§opacity: Option<f32>

Opacity; absent is fully opaque.

§z_index: Option<i32>

Sibling paint order.

§interaction: Option<Interaction>

Hover / press tints, focus rings, state borders.

§state_visuals: Option<StateVisuals>

:hover / :focus / :active / :drag-over / :disabled patches.

§transitions: Vec<TransitionSpec>

The transition declarations.

§scrollbar: Option<ScrollbarStyle>

Overlay scrollbar styling.

§image_fit: Option<ImageFit>

fit for an image.

§input_paint: Option<TextInputPaint>

Caret and selected-glyph paint of a text field.

§caret_width: Option<CaretWidth>

Caret width of a text field.

§password_character: Option<PasswordCharacter>

Mask character of a text field.

§caret_blink_ms: Option<u32>

caret-blink, which lands on the one shared blink clock.

§track: Option<TrackStyle>

A <toggle> / <switch> track palette.

§checkbox: Option<CheckboxStyle>

A <checkbox>’s checked fill.

§radio: Option<RadioStyle>

A <radio>’s selected fill.

§tab_button: Option<TabButtonStyle>

A tab strip button’s palette.

§progress_chunk: Option<ProgressChunk>

An indeterminate <progress>’s sweep width.

§popup_gap: Option<PopupGap>

The gap a dropdown’s panel opens at.

§knob_geometry: Option<KnobGeometry>

Knob and thumb geometry of a <toggle> / <switch> / <slider>.

§knob_fill: Color

Knob and thumb fill.

Implementations§

Source§

impl ComputedStyle

Source

pub fn new(ctx: &StyleContext<'_>, attrs: &Attributes) -> Self

Compute the style components of an element from its resolved attributes.

Source

pub fn insert(self, ent: &mut EntityWorldMut<'_>)

Insert every component onto a freshly spawned element.

Source

pub fn commit(self, ent: &mut EntityWorldMut<'_>, animate: bool)

Replace a live element’s style components with these.

A component this does not carry is removed, so a property nothing sets any more goes back to its initial value. A value a runtime system holds in StyleOverrides stays on top, and the cascade’s new value becomes what it falls back to when the system lets go. A property with a transition tweens from what is on screen to its new value when animate; a tween already running is retargeted from where it is. Each component is written only when it changed, so an unchanged restyle marks nothing changed.

Trait Implementations§

Source§

impl Clone for ComputedStyle

Source§

fn clone(&self) -> ComputedStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComputedStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,