Trait product_os_capabilities::Feature

source ·
pub trait Feature: Send + Sync + Any {
    // Required methods
    fn register<'life0, 'life1, 'async_trait>(
        &'life0 self,
        feature: Arc<dyn Feature>,
        base_path: String,
        router: &'life1 mut ProductOSRouter,
    ) -> Pin<Box<dyn Future<Output = RegistryFeature> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn register_mut<'life0, 'life1, 'async_trait>(
        &'life0 self,
        feature: Arc<Mutex<dyn Feature>>,
        base_path: String,
        router: &'life1 mut ProductOSRouter,
    ) -> Pin<Box<dyn Future<Output = RegistryFeature> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn identifier(&self) -> String;
    fn request<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Body>,
        version: String,
    ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn request_mut<'life0, 'async_trait>(
        &'life0 mut self,
        request: Request<Body>,
        version: String,
    ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn init_feature<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn init_feature_mut<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

source

fn register<'life0, 'life1, 'async_trait>( &'life0 self, feature: Arc<dyn Feature>, base_path: String, router: &'life1 mut ProductOSRouter, ) -> Pin<Box<dyn Future<Output = RegistryFeature> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn register_mut<'life0, 'life1, 'async_trait>( &'life0 self, feature: Arc<Mutex<dyn Feature>>, base_path: String, router: &'life1 mut ProductOSRouter, ) -> Pin<Box<dyn Future<Output = RegistryFeature> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn identifier(&self) -> String

source

fn request<'life0, 'async_trait>( &'life0 self, request: Request<Body>, version: String, ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn request_mut<'life0, 'async_trait>( &'life0 mut self, request: Request<Body>, version: String, ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

source

fn init_feature<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn init_feature_mut<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementations§

source§

impl dyn Feature

source

pub fn is<T: Feature>(&self) -> bool

Returns true if the boxed type is the same as T

source

pub fn downcast_ref<T: Feature>(&self) -> Option<&T>

Returns some reference to the boxed value if it is of type T, or None if it isn’t.

source

pub unsafe fn downcast_ref_unchecked<T: Feature>(&self) -> &T

Returns a reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

source

pub fn downcast_mut<T: Feature>(&mut self) -> Option<&mut T>

Returns some mutable reference to the boxed value if it is of type T, or None if it isn’t.

source

pub unsafe fn downcast_mut_unchecked<T: Feature>(&mut self) -> &mut T

Returns a mutable reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

source§

impl dyn Feature

source

pub fn downcast<T: Feature>(self: Box<Self>) -> Result<Box<T>, Box<Self>>

Returns the boxed value if it is of type T, or Err(Self) if it isn’t.

source

pub unsafe fn downcast_unchecked<T: Feature>(self: Box<Self>) -> Box<T>

Returns the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

Implementors§