Skip to main content

SizeQuery

Struct SizeQuery 

Source
#[repr(C)]
pub struct SizeQuery { pub axis: SizeQueryAxis, pub op: SizeQueryOp, pub threshold_px: f32, pub answer: bool, }
Expand description

One recorded window-size query made by a layout() callback.

See LayoutCallbackInfo::window_width_less_than & co. The engine replays these against a prospective new size to decide whether a resize could change the DOM at all: if no recorded answer flips (and no CSS breakpoint is crossed), the callback is provably size-stable across that resize and is not re-invoked.

Fields§

§axis: SizeQueryAxis§op: SizeQueryOp§threshold_px: f32§answer: bool

The answer given at recording time, evaluated against the size the callback actually saw.

Implementations§

Source§

impl SizeQuery

Source

pub fn answer_at(&self, size: LogicalSize) -> bool

What this query would answer at size — compare with Self::answer to detect a flip. MUST mirror the operators of the recording methods exactly (see SizeQueryOp), or the engine would skip a layout() re-invocation right at the boundary the app asked about.

Source

pub fn flips_at(&self, size: LogicalSize) -> bool

Would this query’s answer differ at size from the recorded one?

Trait Implementations§

Source§

impl Clone for SizeQuery

Source§

fn clone(&self) -> SizeQuery

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 Copy for SizeQuery

Source§

impl Debug for SizeQuery

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SizeQuery

Source§

fn eq(&self, other: &SizeQuery) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SizeQuery

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.

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.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.