Struct rustun::message::Request

source ·
pub struct Request<A>(/* private fields */);
Expand description

Request message.

Implementations§

source§

impl<A: Attribute> Request<A>

source

pub fn new(method: Method) -> Self

Makes a new request message.

source

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.

source

pub fn method(&self) -> Method

Returns the method of the message.

source

pub fn transaction_id(&self) -> TransactionId

Returns the transaction ID of the message.

source

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.

source

pub fn attributes(&self) -> impl Iterator<Item = &A>

Returns an iterator that iterates over the known attributes in the message.

source

pub fn add_attribute(&mut self, attribute: A)

Adds the given attribute to the tail of the attributes in the message.

source

pub fn into_message(self) -> Message<A>

Takes ownership of this instance, and returns the internal message.

Trait Implementations§

source§

impl<A: Attribute> AsMut<Message<A>> for Request<A>

source§

fn as_mut(&mut self) -> &mut Message<A>

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<A: Attribute> AsRef<Message<A>> for Request<A>

source§

fn as_ref(&self) -> &Message<A>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A: Clone> Clone for Request<A>

source§

fn clone(&self) -> Request<A>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A: Debug> Debug for Request<A>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V