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>
impl<T, C> PackageTrampoline<T, C>
Sourcepub fn new(trampoline: T) -> Selfwhere
C: Default,
pub fn new(trampoline: T) -> Selfwhere
C: Default,
Creates a new PackageTrampoline
with the given trampoline and a default context.
Sourcepub fn with_default_context(trampoline: T, default_context: C) -> Self
pub fn with_default_context(trampoline: T, default_context: C) -> Self
Creates a new PackageTrampoline
with the given trampoline and a specific default context.
Sourcepub fn trampoline(&self) -> &T
pub fn trampoline(&self) -> &T
Returns a reference to the trampoline function.
Sourcepub fn default_context(&self) -> &C
pub fn default_context(&self) -> &C
Returns a reference to the trampoline context used for all interfaces not otherwise defined.
Sourcepub fn set_default_context(&mut self, context: C)
pub fn set_default_context(&mut self, context: C)
Sets the default context for the trampoline.
Sourcepub fn get_interface_context(&self, interface_name: &str) -> Option<&C>
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.
Sourcepub fn set_interface_context(&mut self, interface_name: &str, context: C)
pub fn set_interface_context(&mut self, interface_name: &str, context: C)
Sets the trampoline context for a specific interface, overriding the default context.
Sourcepub fn remove_interface_context(&mut self, interface_name: &str)
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.
Sourcepub fn interface_trampoline(
&self,
interface_name: &str,
) -> InterfaceTrampoline<T, C>
pub fn interface_trampoline( &self, interface_name: &str, ) -> InterfaceTrampoline<T, C>
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>
impl<D, C: Clone> DynPackageTrampoline<D, C> for PackageTrampoline<Arc<dyn AsyncTrampoline<D, C>>, C>
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>
impl<D, C: Clone> DynPackageTrampoline<D, C> for PackageTrampoline<Arc<dyn Trampoline<D, C>>, C>
fn interface_trampoline( &self, interface_name: &str, ) -> DynInterfaceTrampoline<D, C>
Auto Trait Implementations§
impl<T, C> Freeze for PackageTrampoline<T, C>
impl<T, C> RefUnwindSafe for PackageTrampoline<T, C>where
T: RefUnwindSafe,
C: RefUnwindSafe,
impl<T, C> Send for PackageTrampoline<T, C>
impl<T, C> Sync for PackageTrampoline<T, C>
impl<T, C> Unpin for PackageTrampoline<T, C>
impl<T, C> UnwindSafe for PackageTrampoline<T, C>where
T: UnwindSafe,
C: 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
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>
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>
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