Struct sp_runtime_interface::wasm::ExchangeableFunction[][src]

pub struct ExchangeableFunction<T>(_);

A function which implementation can be exchanged.

Internally this works by swapping function pointers.

Implementations

impl<T> ExchangeableFunction<T>[src]

pub const fn new(impl_: T) -> Self[src]

Create a new instance of ExchangeableFunction.

impl<T: Copy> ExchangeableFunction<T>[src]

pub fn replace_implementation(
    &'static self,
    new_impl: T
) -> RestoreImplementation<T>
[src]

Replace the implementation with new_impl.

Panics

Panics when trying to replace an already replaced implementation.

Returns

Returns the original implementation wrapped in RestoreImplementation.

pub fn get(&self) -> T[src]

Returns the internal function pointer.

Trait Implementations

Auto Trait Implementations

impl<T> !RefUnwindSafe for ExchangeableFunction<T>[src]

impl<T> Send for ExchangeableFunction<T> where
    T: Send
[src]

impl<T> Unpin for ExchangeableFunction<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for ExchangeableFunction<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.