pub struct SizeElement { /* private fields */ }Expand description
Element that bounds the size of its content: a plain element, which a chain keeps as words.
Matches Kotlin: SizeElement in foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Size.kt
Implementations§
Source§impl SizeElement
impl SizeElement
Sourcepub fn new(width: Option<f32>, height: Option<f32>) -> Self
pub fn new(width: Option<f32>, height: Option<f32>) -> Self
Creates an element that fixes the width and height, in logical pixels. A None length is
left free. The incoming constraints take precedence.
Sourcepub fn with_constraints(
min_width: Option<f32>,
max_width: Option<f32>,
min_height: Option<f32>,
max_height: Option<f32>,
enforce_incoming: bool,
) -> Self
pub fn with_constraints( min_width: Option<f32>, max_width: Option<f32>, min_height: Option<f32>, max_height: Option<f32>, enforce_incoming: bool, ) -> Self
Creates an element with the given widths and heights, in logical pixels. A None bound is
left open. When enforce_incoming is true, the incoming constraints take precedence over
these bounds.
Sourcepub fn min_width(&self) -> Option<f32>
pub fn min_width(&self) -> Option<f32>
Returns the smallest width in logical pixels, or None for no minimum.
Sourcepub fn max_width(&self) -> Option<f32>
pub fn max_width(&self) -> Option<f32>
Returns the largest width in logical pixels, or None for no maximum.
Sourcepub fn min_height(&self) -> Option<f32>
pub fn min_height(&self) -> Option<f32>
Returns the smallest height in logical pixels, or None for no minimum.
Sourcepub fn max_height(&self) -> Option<f32>
pub fn max_height(&self) -> Option<f32>
Returns the largest height in logical pixels, or None for no maximum.
Sourcepub fn enforce_incoming(&self) -> bool
pub fn enforce_incoming(&self) -> bool
Returns whether the incoming constraints take precedence over these bounds.
Trait Implementations§
Source§impl Clone for SizeElement
impl Clone for SizeElement
Source§impl Debug for SizeElement
impl Debug for SizeElement
Source§impl PartialEq for SizeElement
impl PartialEq for SizeElement
Source§impl PlainElement for SizeElement
impl PlainElement for SizeElement
Source§const WORDS: usize = 5
const WORDS: usize = 5
PLAIN_WORDS_MAX.Source§const CAPABILITIES: NodeCapabilities = NodeCapabilities::LAYOUT
const CAPABILITIES: NodeCapabilities = NodeCapabilities::LAYOUT
Source§const UPDATE_INVALIDATION: Option<InvalidationKind>
const UPDATE_INVALIDATION: Option<InvalidationKind>
None to
invalidate every stage of Self::CAPABILITIES.Source§const LAYOUT: Option<&'static PlainLayoutFns>
const LAYOUT: Option<&'static PlainLayoutFns>
NodeCapabilities::LAYOUT: Some(&PlainLayoutFns::of::<Self>())
for a PlainLayout. None, the default, passes the content’s
measure through.Source§fn to_words(&self, words: &mut [u32])
fn to_words(&self, words: &mut [u32])
words, which holds Self::WORDS words.Source§fn from_words(words: &[u32]) -> Self
fn from_words(words: &[u32]) -> Self
Self::to_words wrote into words.Source§fn inspector_name(&self) -> &'static str
fn inspector_name(&self) -> &'static str
Source§impl PlainLayout for SizeElement
impl PlainLayout for SizeElement
Source§const PREPARES: bool = true
const PREPARES: bool = true
Self::prepared changes the element: false, the
default, lets a coordinator copy the words as they are.Source§fn prepared(self, at: PrepareAt) -> Self
fn prepared(self, at: PrepareAt) -> Self
at tells:
an element that rounds its values to device pixels, or mirrors them
for a layout direction, may do so here once, and measure from those
values. The default is the element itself.Source§fn measure_hold(
&self,
density: f32,
_constraints: Constraints,
size: Size,
wrapped: WrappedHold,
) -> Option<ConstraintsHold>
fn measure_hold( &self, density: f32, _constraints: Constraints, size: Size, wrapped: WrappedHold, ) -> Option<ConstraintsHold>
size under
constraints, holds for; see
super::super::LayoutModifierNode::measure_hold.Source§fn measure(
&self,
context: &mut dyn ModifierNodeContext,
measurable: &dyn Measurable,
constraints: Constraints,
) -> LayoutModifierMeasureResult
fn measure( &self, context: &mut dyn ModifierNodeContext, measurable: &dyn Measurable, constraints: Constraints, ) -> LayoutModifierMeasureResult
constraints and returns the size
the element takes and where it places the content.Source§fn intrinsic(
&self,
measurable: &dyn Measurable,
kind: PlainIntrinsic,
density: f32,
) -> f32
fn intrinsic( &self, measurable: &dyn Measurable, kind: PlainIntrinsic, density: f32, ) -> f32
kind names: the wrapped content’s by default,
for an element that keeps the content’s size.impl StructuralPartialEq for SizeElement
Auto Trait Implementations§
impl Forget for SizeElement
impl Freeze for SizeElement
impl Move for SizeElement
impl RefUnwindSafe for SizeElement
impl Send for SizeElement
impl Sync for SizeElement
impl Unpin for SizeElement
impl UnsafeUnpin for SizeElement
impl UnwindSafe for SizeElement
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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 more