rama::net::client

Trait ReqToConnID

pub trait ReqToConnID<State, Request>:
    Sized
    + Send
    + Sync
    + 'static {
    type ConnID: Send + Sync + PartialEq + Clone + 'static;

    // Required method
    fn id(
        &self,
        ctx: &Context<State>,
        request: &Request,
    ) -> Result<Self::ConnID, OpaqueError>;
}
Expand description

ReqToConnID is used to convert a Request to a connection ID. These IDs are not unique and multiple connections can have the same ID. IDs are used to filter which connections can be used for a specific Request in a way that is indepent of what a Request is.

Required Associated Types§

type ConnID: Send + Sync + PartialEq + Clone + 'static

Required Methods§

fn id( &self, ctx: &Context<State>, request: &Request, ) -> Result<Self::ConnID, OpaqueError>

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§

§

impl<State, Request, ConnID, F> ReqToConnID<State, Request> for F
where F: Fn(&Context<State>, &Request) -> Result<ConnID, OpaqueError> + Send + Sync + 'static, ConnID: Send + Sync + PartialEq + Clone + 'static,

§

type ConnID = ConnID