pub struct PathCache { /* private fields */ }Expand description
A tessellated path reused across frames while its shape is unchanged.
A chart repaints on every frame it is on screen — a scrolling list moves
it — and tessellating its strokes (Catmull-Rom curves, dashes) is the bulk
of that work, while the vertices only depend on the projected points
relative to the chart’s origin. A plot keeps one cache per shape and paints
through Line::paint_cached or
Area::paint_cached: the path is built
once per shape key, at a zero origin, and moved to the frame’s origin on
every paint.
Implementations§
Source§impl PathCache
impl PathCache
Sourcepub fn get(
&mut self,
key: u64,
origin: Point<Pixels>,
build: impl FnOnce() -> Option<Path>,
) -> Option<Path>
pub fn get( &mut self, key: u64, origin: Point<Pixels>, build: impl FnOnce() -> Option<Path>, ) -> Option<Path>
The path for key at origin. build runs only when the key or the
origin differs from the last call’s; it must build at origin.
A finished Path can no longer be moved, so a path is reused only
while the shape stays at the same origin.
Trait Implementations§
Auto Trait Implementations§
impl Forget for PathCache
impl Freeze for PathCache
impl Move for PathCache
impl RefUnwindSafe for PathCache
impl Send for PathCache
impl Sync for PathCache
impl Unpin for PathCache
impl UnsafeUnpin for PathCache
impl UnwindSafe for PathCache
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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<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> ⓘ
Converts
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> ⓘ
Converts
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> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().