use Attribute;
use types::U12;
use message::{Request, Indication};
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
{
Request::new(self)
}
fn indication<A>(self) -> Indication<Self, A>
where Self: Indicatable,
A: Attribute
{
Indication::new(self)
}
}
impl Method for U12 {
fn from_u12(codepoint: U12) -> Option<Self> {
Some(codepoint)
}
fn as_u12(&self) -> U12 {
*self
}
}
pub trait Requestable: Method {}
pub trait Indicatable: Method {}