Trait SessionRepository

Source
pub trait SessionRepository<Session>:
    Send
    + Sync
    + 'static {
    type GetError: Debug + Send + Sync + 'static;
    type SaveError: Debug + Send + Sync + 'static;
    type RemoveError: Debug + Send + Sync + 'static;

    // Required methods
    fn get(
        &self,
        destination: Endpoint,
    ) -> impl Future<Output = Result<Option<Session>, Self::GetError>>;
    fn save(
        &self,
        destination: Endpoint,
        session: Session,
    ) -> impl Future<Output = Result<(), Self::SaveError>>;
    fn remove(
        &self,
        destination: Endpoint,
    ) -> impl Future<Output = Result<(), Self::RemoveError>>;
}

Required Associated Types§

Source

type GetError: Debug + Send + Sync + 'static

Source

type SaveError: Debug + Send + Sync + 'static

Source

type RemoveError: Debug + Send + Sync + 'static

Required Methods§

Source

fn get( &self, destination: Endpoint, ) -> impl Future<Output = Result<Option<Session>, Self::GetError>>

Source

fn save( &self, destination: Endpoint, session: Session, ) -> impl Future<Output = Result<(), Self::SaveError>>

Source

fn remove( &self, destination: Endpoint, ) -> impl Future<Output = Result<(), Self::RemoveError>>

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<Session> SessionRepository<Session> for RwLock<HashMap<Endpoint, Session>>
where Session: Clone + Send + Sync + 'static,

Source§

type GetError = ()

Source§

type SaveError = ()

Source§

type RemoveError = ()

Source§

async fn get(&self, destination: Endpoint) -> Result<Option<Session>, ()>

Source§

async fn save(&self, destination: Endpoint, session: Session) -> Result<(), ()>

Source§

async fn remove(&self, destination: Endpoint) -> Result<(), ()>

Implementors§