pub struct AnyPiece(/* private fields */);Expand description
Type-erased piece for heterogeneous branches and dynamic construction.
Implementations§
Source§impl AnyPiece
impl AnyPiece
pub fn new<P: Piece>(p: P) -> Self
Sourcepub fn any(self) -> AnyPiece
pub fn any(self) -> AnyPiece
Already erased: hands itself back instead of boxing a box.
Inherent so it shadows the blanket Decorate::any (inherent methods win method
resolution). Every Decorate modifier returns an erased piece, so .padding(8.0).any()
and friends are common in app code and would otherwise pay a second allocation and a
second indirect call for nothing.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AnyPiece
impl !Send for AnyPiece
impl !Sync for AnyPiece
impl !UnwindSafe for AnyPiece
impl Freeze for AnyPiece
impl Unpin for AnyPiece
impl UnsafeUnpin for AnyPiece
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<T> ErasedDestructor for Twhere
T: 'static,
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