Skip to main content

DictExt

Trait DictExt 

Source
pub trait DictExt {
    // Required methods
    fn get_capability(&self, path: &impl IterablePath) -> Option<Capability>;
    fn get_router_or_not_found<T>(
        &self,
        path: &impl IterablePath,
        not_found_error: RoutingError,
    ) -> Router<T>
       where T: CapabilityBound,
             Router<T>: TryFrom<Capability>;
    fn insert_capability(
        &self,
        path: &impl IterablePath,
        capability: Capability,
    ) -> Option<Capability>;
    fn remove_capability(&self, path: &impl IterablePath) -> Option<Capability>;
    fn get_with_request<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        moniker: &'life1 ExtendedMoniker,
        path: &'a (impl 'async_trait + IterablePath),
        request: RouteRequest,
        target: WeakInstanceToken,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Capability>, RouterError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_with_request_debug<'a, 'life0, 'life1, 'async_trait>(
        &'life0 self,
        moniker: &'life1 ExtendedMoniker,
        path: &'a (impl 'async_trait + IterablePath),
        request: RouteRequest,
        target: WeakInstanceToken,
    ) -> Pin<Box<dyn Future<Output = Result<CapabilitySource, RouterError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn get_capability(&self, path: &impl IterablePath) -> Option<Capability>

Returns the capability at the path, if it exists. Returns None if path is empty.

Source

fn get_router_or_not_found<T>( &self, path: &impl IterablePath, not_found_error: RoutingError, ) -> Router<T>

Looks up a top-level router in this Dictionary with return type T. If it’s not found (or it’s not a router) returns a router that always returns not_found_error. If path has one segment and a router was found, returns that router.

If path is a multi-segment path, the returned router performs a Dictionary lookup with the remaining path relative to the top-level router (see [LazyGet::lazy_get]).

REQUIRES: path is not empty.

Source

fn insert_capability( &self, path: &impl IterablePath, capability: Capability, ) -> Option<Capability>

Inserts the capability at the path. Intermediary dictionaries are created as needed. If there’s already a capability at the path, then the preexisting value is returned.

Source

fn remove_capability(&self, path: &impl IterablePath) -> Option<Capability>

Removes the capability at the path, if it exists, and returns it.

Source

fn get_with_request<'a, 'life0, 'life1, 'async_trait>( &'life0 self, moniker: &'life1 ExtendedMoniker, path: &'a (impl 'async_trait + IterablePath), request: RouteRequest, target: WeakInstanceToken, ) -> Pin<Box<dyn Future<Output = Result<Option<Capability>, RouterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Looks up the element at path. When encountering an intermediate router, use request to request the underlying capability from it. In contrast, get_capability will return None.

Note that the return value can contain any capability type, instead of a parameterized T. This is because some callers work with a generic capability and don’t care about the specific type.

Source

fn get_with_request_debug<'a, 'life0, 'life1, 'async_trait>( &'life0 self, moniker: &'life1 ExtendedMoniker, path: &'a (impl 'async_trait + IterablePath), request: RouteRequest, target: WeakInstanceToken, ) -> Pin<Box<dyn Future<Output = Result<CapabilitySource, RouterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Identical to get_with_request, except it returns the source of the capability at path instead of the capability itself.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl DictExt for Dictionary

Source§

fn get_capability(&self, path: &impl IterablePath) -> Option<Capability>

Source§

fn get_router_or_not_found<T>( &self, path: &impl IterablePath, not_found_error: RoutingError, ) -> Router<T>

Source§

fn insert_capability( &self, path: &impl IterablePath, capability: Capability, ) -> Option<Capability>

Source§

fn remove_capability(&self, path: &impl IterablePath) -> Option<Capability>

Source§

fn get_with_request<'a, 'life0, 'life1, 'async_trait>( &'life0 self, moniker: &'life1 ExtendedMoniker, path: &'a (impl 'async_trait + IterablePath), request: RouteRequest, target: WeakInstanceToken, ) -> Pin<Box<dyn Future<Output = Result<Option<Capability>, RouterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_with_request_debug<'a, 'life0, 'life1, 'async_trait>( &'life0 self, moniker: &'life1 ExtendedMoniker, path: &'a (impl 'async_trait + IterablePath), request: RouteRequest, target: WeakInstanceToken, ) -> Pin<Box<dyn Future<Output = Result<CapabilitySource, RouterError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§