pub struct InlineFnMut<'a, Sig: FnSig, const SIZE: usize = DEFAULT_INLINE_FN_SIZE, S = Local> { /* private fields */ }Expand description
An inline-stored, partially type-erased FnMut closure with compile-time capacity SIZE.
Like InlineFn, InlineFnMut stores the callable inline without heap allocation, but
takes &mut self on invocation, allowing the wrapped closure to mutate its captured state.
Implementations§
Source§impl<'a, Sig: FnSig, const SIZE: usize, S> InlineFnMut<'a, Sig, SIZE, S>
impl<'a, Sig: FnSig, const SIZE: usize, S> InlineFnMut<'a, Sig, SIZE, S>
Sourcepub fn new<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + 'a,
S: ThreadSafety<F>,
pub fn new<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + 'a,
S: ThreadSafety<F>,
Wraps a mutable closure inline, asserting at compile time that its size is
<= SIZE and alignment is <= 8.
Sourcepub fn resize<const NEW_SIZE: usize>(self) -> InlineFnMut<'a, Sig, NEW_SIZE, S>
pub fn resize<const NEW_SIZE: usize>(self) -> InlineFnMut<'a, Sig, NEW_SIZE, S>
Widens the inline storage capacity to NEW_SIZE bytes (NEW_SIZE >= SIZE).
Fails to compile if NEW_SIZE < SIZE.
Sourcepub fn into_local(self) -> InlineFnMut<'a, Sig, SIZE, Local>
pub fn into_local(self) -> InlineFnMut<'a, Sig, SIZE, Local>
Relaxes the thread-safety marker of this InlineFnMut to Local (!Send + !Sync).
Sourcepub fn into_fn_once(self) -> InlineFnOnce<'a, Sig, SIZE, S>
pub fn into_fn_once(self) -> InlineFnOnce<'a, Sig, SIZE, S>
Converts this mutable InlineFnMut into a single-use InlineFnOnce with the same
capacity and thread-safety bounds at zero cost.
Source§impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, Local>
impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, Local>
Sourcepub fn new_local<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + 'a,
pub fn new_local<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + 'a,
Creates a local (!Send + !Sync) InlineFnMut.
Source§impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, SendOnly>
impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, SendOnly>
Sourcepub fn new_send<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + Send + 'a,
pub fn new_send<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + Send + 'a,
Creates a Send (!Sync) InlineFnMut.
Source§impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, SendSync>
impl<'a, Sig: FnSig, const SIZE: usize> InlineFnMut<'a, Sig, SIZE, SendSync>
Sourcepub fn new_send_sync<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + Send + Sync + 'a,
pub fn new_send_sync<F>(closure: F) -> Selfwhere
F: FnMutWithSig<Sig> + Send + Sync + 'a,
Creates a Send + Sync InlineFnMut.