pub struct LazyTextPipeline { /* private fields */ }Expand description
A TextPipeline that defers parsing its font bytes until the first use.
Fonts can be large; this wrapper avoids upfront parsing cost by storing the
raw bytes and initialising the inner TextPipeline on the first call to
LazyTextPipeline::get.
Implementations§
Source§impl LazyTextPipeline
impl LazyTextPipeline
Sourcepub fn new(font_bytes: Vec<u8>) -> Self
pub fn new(font_bytes: Vec<u8>) -> Self
Create a new LazyTextPipeline that will parse font_bytes on demand.
Sourcepub fn get(&self) -> Result<&TextPipeline, TextError>
pub fn get(&self) -> Result<&TextPipeline, TextError>
Return a reference to the inner TextPipeline, initialising it on
the first call.
§Errors
Returns TextError::Pipeline if the font bytes are invalid.
Auto Trait Implementations§
impl !Freeze for LazyTextPipeline
impl !RefUnwindSafe for LazyTextPipeline
impl Send for LazyTextPipeline
impl !Sync for LazyTextPipeline
impl Unpin for LazyTextPipeline
impl UnsafeUnpin for LazyTextPipeline
impl !UnwindSafe for LazyTextPipeline
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
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 more