pub struct Canvas { /* private fields */ }Expand description
A finite drawing surface and its ordered, owned frame items.
Implementations§
Source§impl Canvas
impl Canvas
pub const fn new() -> Self
Sourcepub fn sizing(self, sizing: CanvasSizing) -> Self
pub fn sizing(self, sizing: CanvasSizing) -> Self
Replaces this Canvas’s complete sizing policy.
Ordinary callers use viewport sizing. Built-in presentations may bind an opaque intrinsic value internally; sizing remains independent of the Canvas’s ordered items in either case.
Sourcepub const fn width(self, width: usize) -> Self
pub const fn width(self, width: usize) -> Self
States viewport sizing’s extent on an unbounded width axis.
§Panics
Panics when a crate-provided intrinsic sizing value is already installed.
Sourcepub const fn height(self, height: usize) -> Self
pub const fn height(self, height: usize) -> Self
States viewport sizing’s extent on an unbounded height axis.
§Panics
Panics when a crate-provided intrinsic sizing value is already installed.
Sourcepub const fn extent(self, size: Size) -> Self
pub const fn extent(self, size: Size) -> Self
States both unbounded-axis extents of viewport sizing.
§Panics
Panics when a crate-provided intrinsic sizing value is already installed.
Sourcepub fn items<T>(&self) -> impl Iterator<Item = &T>
pub fn items<T>(&self) -> impl Iterator<Item = &T>
Returns the directly owned items whose concrete type is T.
This is the typed extension boundary for an adapter that owns a
CanvasItem implementation. Core layout remains unaware of that
item’s meaning; the adapter can recover its own immutable values from
a composed Canvas without exposing Any or a fallible downcast.