Struct sp_runtime_interface::wasm::ExchangeableFunction
source · pub struct ExchangeableFunction<T>(/* private fields */);
Expand description
A function which implementation can be exchanged.
Internally this works by swapping function pointers.
Implementations§
source§impl<T> ExchangeableFunction<T>
impl<T> ExchangeableFunction<T>
source§impl<T: Copy> ExchangeableFunction<T>
impl<T: Copy> ExchangeableFunction<T>
sourcepub fn replace_implementation(
&'static self,
new_impl: T,
) -> RestoreImplementation<T>
pub fn replace_implementation( &'static self, new_impl: T, ) -> RestoreImplementation<T>
Replace the implementation with new_impl
.
§Panics
Panics when trying to replace an already replaced implementation.
§Returns
Returns the original implementation wrapped in RestoreImplementation
.
Trait Implementations§
impl<T> Sync for ExchangeableFunction<T>
Auto Trait Implementations§
impl<T> !Freeze for ExchangeableFunction<T>
impl<T> !RefUnwindSafe for ExchangeableFunction<T>
impl<T> Send for ExchangeableFunction<T>where
T: Send,
impl<T> Unpin for ExchangeableFunction<T>where
T: Unpin,
impl<T> UnwindSafe for ExchangeableFunction<T>where
T: 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
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 more