pub enum SheetSize {
OneThird,
Half,
TwoThirds,
Ratio(f32),
Pixels(f32),
}Expand description
The size a sheet should occupy along the axis perpendicular to its anchor edge.
- For a top- or bottom-anchored sheet,
SheetSizeis a height. - For a start- or end-anchored sheet,
SheetSizeis a width.
Use the named variants for canonical proportions; use SheetSize::Ratio
for arbitrary fractions (clamped to 0.0..=1.0); use SheetSize::Pixels
for a fixed pixel size independent of window dimensions (discouraged for
responsive apps).
Variants§
OneThird
33 % of the window’s relevant axis — the default “drawer” size.
Half
50 % of the window’s relevant axis.
TwoThirds
67 % of the window’s relevant axis.
Ratio(f32)
Arbitrary fraction of the window’s relevant axis. Values outside
0.0..=1.0 are clamped by the engine.
Pixels(f32)
Fixed pixel size. Only use when the content has a natural size that does not scale with the window.
Implementations§
Source§impl SheetSize
impl SheetSize
Sourcepub fn as_ratio(self) -> Option<f32>
pub fn as_ratio(self) -> Option<f32>
Resolve to a fraction of the relevant axis, if this variant
expresses one. Returns None for SheetSize::Pixels.
§Example
use snora_core::SheetSize;
assert_eq!(SheetSize::Half.as_ratio(), Some(0.5));
assert_eq!(SheetSize::Ratio(1.5).as_ratio(), Some(1.0)); // clamped
assert_eq!(SheetSize::Pixels(240.0).as_ratio(), None);Trait Implementations§
impl Copy for SheetSize
impl StructuralPartialEq for SheetSize
Auto Trait Implementations§
impl Freeze for SheetSize
impl RefUnwindSafe for SheetSize
impl Send for SheetSize
impl Sync for SheetSize
impl Unpin for SheetSize
impl UnsafeUnpin for SheetSize
impl UnwindSafe for SheetSize
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.