Struct layout_2020::geom::Sizes
source · pub(crate) struct Sizes {
pub preferred: Size<Au>,
pub min: Size<Au>,
pub max: Size<Au>,
}
Fields§
§preferred: Size<Au>
§min: Size<Au>
§max: Size<Au>
Implementations§
source§impl Sizes
impl Sizes
pub(crate) fn new(preferred: Size<Au>, min: Size<Au>, max: Size<Au>) -> Self
pub(crate) fn depends_on_available_space(&self) -> bool
sourcepub(crate) fn resolve(
&self,
automatic_size: Size<Au>,
automatic_minimum_size: Au,
stretch_size: Au,
get_content_size: impl FnOnce() -> ContentSizes,
) -> Au
pub(crate) fn resolve( &self, automatic_size: Size<Au>, automatic_minimum_size: Au, stretch_size: Au, get_content_size: impl FnOnce() -> ContentSizes, ) -> Au
Resolves the three sizes into a single numerical value.
sourcepub(crate) fn resolve_each(
&self,
automatic_size: Size<Au>,
automatic_minimum_size: Au,
stretch_size: Au,
get_content_size: impl FnOnce() -> ContentSizes,
) -> (Au, Au, Option<Au>)
pub(crate) fn resolve_each( &self, automatic_size: Size<Au>, automatic_minimum_size: Au, stretch_size: Au, get_content_size: impl FnOnce() -> ContentSizes, ) -> (Au, Au, Option<Au>)
Resolves each of the three sizes into a numerical value, separately.
sourcepub(crate) fn resolve_extrinsic(
&self,
automatic_size: Size<Au>,
automatic_minimum_size: Au,
stretch_size: Option<Au>,
) -> SizeConstraint
pub(crate) fn resolve_extrinsic( &self, automatic_size: Size<Au>, automatic_minimum_size: Au, stretch_size: Option<Au>, ) -> SizeConstraint
Tries to extrinsically resolve the three sizes into a single SizeConstraint
.
Values that are intrinsic or need stretch_size
when it’s None
are handled as such:
- On the preferred size, they make the returned value be an indefinite
SizeConstraint::MinMax
. - On the min size, they are treated as
auto
, enforcing the automatic minimum size. - On the max size, they are treated as
none
, enforcing no maximum.
sourcepub(crate) fn resolve_each_extrinsic(
&self,
automatic_size: Size<Au>,
automatic_minimum_size: Au,
stretch_size: Option<Au>,
) -> (Option<Au>, Au, Option<Au>)
pub(crate) fn resolve_each_extrinsic( &self, automatic_size: Size<Au>, automatic_minimum_size: Au, stretch_size: Option<Au>, ) -> (Option<Au>, Au, Option<Au>)
Tries to extrinsically resolve each of the three sizes into a numerical value, separately.
This can’t resolve values that are intrinsic or need stretch_size
but it’s None
.
- The 1st returned value is the resolved preferred size. If it can’t be resolved then
the returned value is
None
. Note that this is different than treating it asauto
. TODO: This needs to be discussed in https://github.com/w3c/csswg-drafts/issues/11387. - The 2nd returned value is the resolved minimum size. If it can’t be resolved then we
treat it as the initial
auto
, returning the automatic minimum size. - The 3rd returned value is the resolved maximum size. If it can’t be resolved then we
treat it as the initial
none
, returningNone
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sizes
impl RefUnwindSafe for Sizes
impl Send for Sizes
impl Sync for Sizes
impl Unpin for Sizes
impl UnwindSafe for Sizes
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.