pub trait Shape {
type Iter: IntoIterator<Item = PathCommand>;
// Required method
fn path(&self) -> Self::Iter;
// Provided method
fn shape_kind(&self) -> ShapeKind { ... }
}Expand description
A trait for types that can produce path commands for clipping.
All coordinates are normalized (0.0-1.0) and scale with view bounds. Built-in shapes use stack-allocated arrays for zero heap allocation.
Required Associated Types§
Sourcetype Iter: IntoIterator<Item = PathCommand>
type Iter: IntoIterator<Item = PathCommand>
The iterator type returned by path().
Required Methods§
Provided Methods§
Sourcefn shape_kind(&self) -> ShapeKind
fn shape_kind(&self) -> ShapeKind
Returns what this shape is, for backends that can render it directly.
Prefer this over Self::path wherever a backend can act on it. Path
commands are normalized per axis, so resolving them against a non-square
rect makes circular corners elliptical; the kind lets a backend resolve a
normalized radius against the shorter side instead. Defaults to
ShapeKind::CustomPath, which means “only the path describes me”.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".