gotcha

Trait GotchaApp

Source
pub trait GotchaApp:
    Sized
    + Send
    + Sync {
    type State: Clone + Send + Sync + 'static;
    type Config: Clone + Send + Sync + 'static + Serialize + for<'de> Deserialize<'de>;

    // Required methods
    fn routes(
        &self,
        router: GotchaRouter<GotchaContext<Self::State, Self::Config>>,
    ) -> GotchaRouter<GotchaContext<Self::State, Self::Config>>;
    fn state<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::State, Box<dyn Error>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn logger(&self) -> Result<(), Box<dyn Error>> { ... }
    fn tasks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _task_scheduler: &'life1 mut TaskScheduler<Self::State, Self::Config>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn run<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
       where Self: 'async_trait { ... }
}

Required Associated Types§

Source

type State: Clone + Send + Sync + 'static

Source

type Config: Clone + Send + Sync + 'static + Serialize + for<'de> Deserialize<'de>

Required Methods§

Source

fn routes( &self, router: GotchaRouter<GotchaContext<Self::State, Self::Config>>, ) -> GotchaRouter<GotchaContext<Self::State, Self::Config>>

Source

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

Provided Methods§

Source

fn logger(&self) -> Result<(), Box<dyn Error>>

Source

fn tasks<'life0, 'life1, 'async_trait>( &'life0 self, _task_scheduler: &'life1 mut TaskScheduler<Self::State, Self::Config>, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

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

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.

Implementors§