Skip to main content

AnyBoxConstraints

Struct AnyBoxConstraints 

Source
pub struct AnyBoxConstraints { /* private fields */ }
Expand description

A BoxConstraints that may be an instance of a BoxConstraints subclass.

Rendering stores this where Flutter stores constraints that a later reader type-checks: a box’s constraints from its last AnyRenderBox::layout, read back with any_constraints, and what a LayoutBuilder hands its builder. The plain value is the one the subclass passed to super, reached by constraints or by deref, so every BoxConstraints method is available and returns a plain BoxConstraints, as an inherited method does in Dart. The subclass is recovered with extension, Dart’s is check.

Equality follows Dart’s: two plain constraints compare by value, two extended ones by value and by the subclass’s ==, and a plain value never equals an extended one. So AnyRenderBox::layout’s early return lays out again when only the extension changed.

A box’s constraints is the plain value: a render object that hands its own constraints on to its child passes the value without the extension.

Implementations§

Source§

impl AnyBoxConstraints

Source

pub const fn new(constraints: BoxConstraints) -> AnyBoxConstraints

Plain constraints.

Source

pub fn with_shared( constraints: BoxConstraints, extension: Rc<dyn BoxConstraintsExtension>, ) -> AnyBoxConstraints

A subclass instance: constraints is what it passed to super.

Source

pub fn constraints(&self) -> BoxConstraints

The constraints as a layout reads them: the subclass’s super value.

Source

pub fn extension<T>(&self) -> Option<&T>

Dart’s constraints is T: the subclass instance, if these constraints are one.

Source

pub fn has_extension(&self) -> bool

Whether these constraints are a subclass instance.

Trait Implementations§

Source§

impl Clone for AnyBoxConstraints

Source§

fn clone(&self) -> AnyBoxConstraints

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 AnyBoxConstraints

A subclass prints as its BoxConstraints: neither scaffold subclass overrides toString.

Source§

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

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

impl Deref for AnyBoxConstraints

Source§

type Target = BoxConstraints

The resulting type after dereferencing.
Source§

fn deref(&self) -> &BoxConstraints

Dereferences the value.
Source§

impl From<BoxConstraints> for AnyBoxConstraints

Source§

fn from(constraints: BoxConstraints) -> AnyBoxConstraints

Converts to this type from the input type.
Source§

impl PartialEq for AnyBoxConstraints

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl PartialEq<BoxConstraints> for AnyBoxConstraints

Source§

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

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

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

Inequality operator !=. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>