PackageTrampoline

Struct PackageTrampoline 

Source
pub struct PackageTrampoline<T, C> { /* private fields */ }
Expand description

A trampoline that manages multiple interfaces and their respect trampoline functions and contexts for a component package.

Implementations§

Source§

impl<T, C> PackageTrampoline<T, C>

Source

pub fn new(trampoline: T) -> Self
where C: Default,

Creates a new PackageTrampoline with the given trampoline and a default context.

Source

pub fn with_default_context(trampoline: T, default_context: C) -> Self

Creates a new PackageTrampoline with the given trampoline and a specific default context.

Source

pub fn trampoline(&self) -> &T

Returns a reference to the trampoline function.

Source

pub fn default_context(&self) -> &C

Returns a reference to the trampoline context used for all interfaces not otherwise defined.

Source

pub fn set_default_context(&mut self, context: C)

Sets the default context for the trampoline.

Source

pub fn get_interface_context(&self, interface_name: &str) -> Option<&C>

Returns a reference to the trampoline context for a specific interface, if it has been overridden. If None is return, it’s expected that the default context will be used.

Source

pub fn set_interface_context(&mut self, interface_name: &str, context: C)

Sets the trampoline context for a specific interface, overriding the default context.

Source

pub fn remove_interface_context(&mut self, interface_name: &str)

Removes the trampoline context override for a specific interface, reverting to the default.

If the interface context override does not exist, this is a no-op.

Source

pub fn interface_trampoline( &self, interface_name: &str, ) -> InterfaceTrampoline<T, C>
where T: Clone, C: Clone,

Returns an InterfaceTrampoline for the specified interface name, using the context

Trait Implementations§

Source§

impl<D, C: Clone> DynPackageTrampoline<D, C> for PackageTrampoline<Arc<dyn AsyncTrampoline<D, C>>, C>

Source§

fn interface_trampoline( &self, interface_name: &str, ) -> DynInterfaceTrampoline<D, C>

Source§

impl<D, C: Clone> DynPackageTrampoline<D, C> for PackageTrampoline<Arc<dyn Trampoline<D, C>>, C>

Source§

fn interface_trampoline( &self, interface_name: &str, ) -> DynInterfaceTrampoline<D, C>

Auto Trait Implementations§

§

impl<T, C> Freeze for PackageTrampoline<T, C>
where T: Freeze, C: Freeze,

§

impl<T, C> RefUnwindSafe for PackageTrampoline<T, C>

§

impl<T, C> Send for PackageTrampoline<T, C>
where T: Send, C: Send,

§

impl<T, C> Sync for PackageTrampoline<T, C>
where T: Sync, C: Sync,

§

impl<T, C> Unpin for PackageTrampoline<T, C>
where T: Unpin, C: Unpin,

§

impl<T, C> UnwindSafe for PackageTrampoline<T, C>
where T: UnwindSafe, C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.