pub enum Size {
Inner,
Fill,
FillMinimum,
Percentage(Length<f32, ()>),
Pixels(Length<f32, ()>),
RootPercentage(Length<f32, ()>),
Fn(Box<SizeFn>),
Flex(Length<f32, ()>),
}Variants§
Inner
Sizes the element based on its content. This is the default.
Can also be created with Size::auto.
let size = Size::auto();Fill
Expands to fill all the available space from its parent.
Can also be created with Size::fill.
let size = Size::fill();FillMinimum
Expand to the biggest sibling when using Content::fit.
Can also be created with Size::fill_minimum.
let size = Size::fill_minimum();Percentage(Length<f32, ()>)
Sizes as a percentage relative to the parent’s size.
Can also be created with Size::percent.
let size = Size::percent(50.0);Pixels(Length<f32, ()>)
RootPercentage(Length<f32, ()>)
Sizes as a percentage relative to the root (window) size.
Can also be created with Size::window_percent.
let size = Size::window_percent(80.0);Fn(Box<SizeFn>)
Dynamic size computed by a closure at layout time.
Can also be created with Size::func or Size::func_data.
Flex(Length<f32, ()>)
Flex grow factor, fills the available space proportionally in the final layout phase.
Can also be created with Size::flex.
let size = Size::flex(1.0);Implementations§
Source§impl Size
impl Size
Sourcepub fn fill_minimum() -> Size
pub fn fill_minimum() -> Size
Use a FillMinimum size.
Sourcepub fn window_percent(percent: impl Into<f32>) -> Size
pub fn window_percent(percent: impl Into<f32>) -> Size
Use a RootPercentage size.
Sourcepub fn func(
func: impl Fn(SizeFnContext) -> Option<f32> + Sync + Send + 'static,
) -> Size
pub fn func( func: impl Fn(SizeFnContext) -> Option<f32> + Sync + Send + 'static, ) -> Size
Use a dynamic Fn size computed by the given closure.
Sourcepub fn func_data<D>(
func: impl Fn(SizeFnContext) -> Option<f32> + Sync + Send + 'static,
data: &D,
) -> Sizewhere
D: Hash,
pub fn func_data<D>(
func: impl Fn(SizeFnContext) -> Option<f32> + Sync + Send + 'static,
data: &D,
) -> Sizewhere
D: Hash,
Use a dynamic Fn size with hashable data for equality checks.
pub fn pretty(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Size
impl<'de> Deserialize<'de> for Size
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Size, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Size, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl ResolvablePreference<Size> for Preference<Size>
impl ResolvablePreference<Size> for Preference<Size>
fn resolve(&self, _colors_sheet: &ColorsSheet) -> Size
Source§impl Serialize for Size
impl Serialize for Size
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl !RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl !UnwindSafe for Size
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
Source§impl<T> ComponentProps for T
impl<T> ComponentProps for T
fn changed(&self, other: &(dyn ComponentProps + 'static)) -> bool
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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 moreSource§impl<T> IntoReadable<T> for Twhere
T: 'static,
impl<T> IntoReadable<T> for Twhere
T: 'static,
fn into_readable(self) -> Readable<T>
§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>
ReadEndian::read_from_little_endian().