Trait rustun::method::Method
[−]
[src]
pub trait Method: Sized { fn from_u12(codepoint: U12) -> Option<Self>; fn as_u12(&self) -> U12; fn request<A>(self) -> Request<Self, A>
where
Self: Requestable,
A: Attribute, { ... } fn indication<A>(self) -> Indication<Self, A>
where
Self: Indicatable,
A: Attribute, { ... } }
STUN method.
All STUN messages start with a fixed header that includes a method, a class, and the transaction ID. The method indicates which of the various requests or indications this is;
Required Methods
fn from_u12(codepoint: U12) -> Option<Self>
Tries to convert from codepoint
to the corresponding method.
If no such method exists, this will return None
.
Examples
use rustun::Method; use rustun::rfc5389::methods::Binding; use rustun::types::U12; assert!(Binding::from_u12(U12::from_u8(1)).is_some()); assert!(Binding::from_u12(U12::from_u8(0)).is_none());
fn as_u12(&self) -> U12
Returns the codepoint corresponding this method.
Example
use rustun::Method; use rustun::rfc5389::methods::Binding; use rustun::types::U12; assert_eq!(Binding.as_u12(), U12::from_u8(1));
Provided Methods
fn request<A>(self) -> Request<Self, A> where
Self: Requestable,
A: Attribute,
Self: Requestable,
A: Attribute,
Makes a request message which have this method.
fn indication<A>(self) -> Indication<Self, A> where
Self: Indicatable,
A: Attribute,
Self: Indicatable,
A: Attribute,
Makes a indication message which have this method.