ServerHandler

Trait ServerHandler 

Source
pub trait ServerHandler: Send {
    // Required methods
    fn connect<R>(&mut self, addr: SocketAddr, result: R)
       where R: for<'a> FnOnce(ServerResult<'a, u64>);
    fn announce<'b, R>(
        &mut self,
        addr: SocketAddr,
        id: u64,
        req: &AnnounceRequest<'b>,
        result: R,
    )
       where R: for<'a> FnOnce(ServerResult<'a, AnnounceResponse<'a>>);
    fn scrape<'b, R>(
        &mut self,
        addr: SocketAddr,
        id: u64,
        req: &ScrapeRequest<'b>,
        result: R,
    )
       where R: for<'a> FnOnce(ServerResult<'a, ScrapeResponse<'a>>);
}
Expand description

Trait for providing a TrackerServer with methods to service TrackerReqeusts.

Required Methods§

Source

fn connect<R>(&mut self, addr: SocketAddr, result: R)
where R: for<'a> FnOnce(ServerResult<'a, u64>),

Service a connection id request from the given address.

If the result callback is not called, no response will be sent.

Source

fn announce<'b, R>( &mut self, addr: SocketAddr, id: u64, req: &AnnounceRequest<'b>, result: R, )
where R: for<'a> FnOnce(ServerResult<'a, AnnounceResponse<'a>>),

Service an announce request with the given connect id.

If the result callback is not called, no response will be sent.

Source

fn scrape<'b, R>( &mut self, addr: SocketAddr, id: u64, req: &ScrapeRequest<'b>, result: R, )
where R: for<'a> FnOnce(ServerResult<'a, ScrapeResponse<'a>>),

Service a scrape request with the given connect id.

If the result callback is not called, no response will be sent.

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§