#[repr(C)]pub struct OpaqueFn<'a, A, R, B: Buffer> { /* private fields */ }Expand description
A fixed-capacity inline function wrapper without allocation.
OpaqueFn<'a, A, R, N> can store any closure or function pointer
that implements Fn(A) -> R and fits into a buffer of size N bytes.
§Note
Use call method to invoke the stored callable.
This is intended as a no-alloc alternative to Box<dyn Fn(A) -> R>.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a, A, R, B> Freeze for OpaqueFn<'a, A, R, B>where
B: Freeze,
impl<'a, A, R, B> RefUnwindSafe for OpaqueFn<'a, A, R, B>where
B: RefUnwindSafe,
impl<'a, A, R, B> Send for OpaqueFn<'a, A, R, B>where
B: Send,
impl<'a, A, R, B> Sync for OpaqueFn<'a, A, R, B>where
B: Sync,
impl<'a, A, R, B> Unpin for OpaqueFn<'a, A, R, B>where
B: Unpin,
impl<'a, A, R, B> UnwindSafe for OpaqueFn<'a, A, R, B>where
B: UnwindSafe,
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