pub struct CanvasSizing(/* private fields */);Expand description
The sizing policy of one Canvas.
CanvasSizing::viewport is the ordinary policy: a Canvas consumes a
finite parent allocation and needs an explicit extent on an unbounded axis.
Built-in presentations may internally construct an intrinsic policy whose
requirements participate in normal View layout without inspecting Canvas
items.
use urushi::{CanvasSizing, Size};
let first = CanvasSizing::viewport().width(12).height(4);
let same = CanvasSizing::viewport().extent(Size::new(12, 4));
assert_eq!(first, same);Implementations§
Source§impl CanvasSizing
impl CanvasSizing
Sourcepub const fn width(self, width: usize) -> Self
pub const fn width(self, width: usize) -> Self
States the extent viewport sizing uses when the width axis is unbounded.
§Panics
Panics when applied to the crate-private intrinsic variant. Replace the
complete policy with Canvas::sizing instead.
Sourcepub const fn height(self, height: usize) -> Self
pub const fn height(self, height: usize) -> Self
States the extent viewport sizing uses when the height axis is unbounded.
§Panics
Panics when applied to the crate-private intrinsic variant. Replace the
complete policy with Canvas::sizing instead.
Sourcepub const fn extent(self, size: Size) -> Self
pub const fn extent(self, size: Size) -> Self
States both fallback extents used by viewport sizing.
§Panics
Panics when applied to the crate-private intrinsic variant. Replace the
complete policy with Canvas::sizing instead.
Trait Implementations§
Source§impl Clone for CanvasSizing
impl Clone for CanvasSizing
Source§fn clone(&self) -> CanvasSizing
fn clone(&self) -> CanvasSizing
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CanvasSizing
impl Debug for CanvasSizing
Source§impl Default for CanvasSizing
impl Default for CanvasSizing
Source§impl PartialEq for CanvasSizing
impl PartialEq for CanvasSizing
Source§fn eq(&self, other: &CanvasSizing) -> bool
fn eq(&self, other: &CanvasSizing) -> bool
self and other values to be equal, and is used by ==.