pub struct Request<A>(/* private fields */);
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>
pub fn get_attribute<T>(&self) -> Option<&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.
Trait Implementations§
Auto Trait Implementations§
impl<A> RefUnwindSafe for Request<A>where
A: RefUnwindSafe,
impl<A> Send for Request<A>where
A: Send,
impl<A> Sync for Request<A>where
A: Sync,
impl<A> Unpin for Request<A>where
A: Unpin,
impl<A> UnwindSafe for Request<A>where
A: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more