pub struct Request<A>(_);Expand description
Request message.
Implementations§
source§impl<A: Attribute> Request<A>
impl<A: Attribute> Request<A>
sourcepub fn from_message(message: Message<A>) -> MessageResult<Self>
pub fn from_message(message: Message<A>) -> MessageResult<Self>
Converts Message to Request.
Errors
If the class of the given message is not MessageClass::Request,
this function will return a MessageErrorKind::InvalidInput error.
And if the message contains some unknown comprehension-required attributes,
this function will return a MessageErrorKind::UnknownAttributes error.
sourcepub fn transaction_id(&self) -> TransactionId
pub fn transaction_id(&self) -> TransactionId
Returns the transaction ID of the message.
sourcepub fn get_attribute<T>(&self) -> Option<&T>where
T: Attribute,
A: TryAsRef<T>,
pub fn get_attribute<T>(&self) -> Option<&T>where
T: Attribute,
A: TryAsRef<T>,
Returns a reference to the first occurance of T attribute in the attributes of the message.
If there is no such attribute, this method will return None.
sourcepub fn attributes(&self) -> impl Iterator<Item = &A>
pub fn attributes(&self) -> impl Iterator<Item = &A>
Returns an iterator that iterates over the known attributes in the message.
sourcepub fn add_attribute(&mut self, attribute: A)
pub fn add_attribute(&mut self, attribute: A)
Adds the given attribute to the tail of the attributes in the message.
sourcepub fn into_message(self) -> Message<A>
pub fn into_message(self) -> Message<A>
Takes ownership of this instance, and returns the internal message.