Trait p2p::NatState [] [src]

pub trait NatState {
    fn as_any(&mut self) -> &mut Any;

    fn ready(&mut self, &mut Interface, &Poll, Ready) { ... }
    fn terminate(&mut self, &mut Interface, &Poll) { ... }
    fn timeout(&mut self, &mut Interface, &Poll, u8) { ... }
}

The main trait that we implement.

All our registered states essentially implement this trait so that the user code can call us and indicate what event was fired for us in poll.

Required Methods

This is for internal use for the crate and is rarely needed.

Provided Methods

To be called when readiness event has fired

To be called when user wants to actively terminate this state. It will do all the necessary clean ups and resource (file/socket descriptors) cleaning freeing so merely calling this is sufficient.

To be called when timeout has been fired and the user has retrieved the state using the token stored inside the NatTimer::associated_nat_state.

Implementors