Struct rustun::message::SuccessResponse
source · pub struct SuccessResponse<A>(/* private fields */);
Expand description
Success response message.
Implementations§
source§impl<A: Attribute> SuccessResponse<A>
impl<A: Attribute> SuccessResponse<A>
sourcepub fn new(request: &Request<A>) -> Self
pub fn new(request: &Request<A>) -> Self
Makes a new SuccessResponse
instance for the success response to the given request.
sourcepub fn from_message(message: Message<A>) -> MessageResult<Self>
pub fn from_message(message: Message<A>) -> MessageResult<Self>
Converts Message
to SuccessResponse
.
§Errors
If the class of the given message is not MessageClass::SuccessResponse
,
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§
source§impl<A: Clone> Clone for SuccessResponse<A>
impl<A: Clone> Clone for SuccessResponse<A>
source§fn clone(&self) -> SuccessResponse<A>
fn clone(&self) -> SuccessResponse<A>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more