pub struct ResponseMessage<'a> { /* private fields */ }
Available on riot_module_gcoap only.

Implementations§

source§

impl<'a> ResponseMessage<'a>

source

pub fn new(buf: &'a mut PacketBuffer) -> Self

source

pub fn finish(&self) -> isize

Trait Implementations§

source§

impl<'a> MinimalWritableMessage for ResponseMessage<'a>

§

type Code = u8

§

type OptionNumber = u16

source§

fn set_code(&mut self, code: Self::Code)

source§

fn add_option(&mut self, number: Self::OptionNumber, value: &[u8])

Add an option to the message Read more
source§

fn set_payload(&mut self, data: &[u8])

source§

fn set_from_message<M>(&mut self, msg: &M)
where M: ReadableMessage,

Copy code, options and payload in from a readable message Read more
source§

fn add_option_str(&mut self, number: Self::OptionNumber, value: &str)

Shortcut for add_option(self, number, value.as_bytes()). Read more
source§

fn add_option_uint<U>(&mut self, number: Self::OptionNumber, value: U)
where U: Ux,

Shortcut for add_option on a buffer containing the uint encoded value Read more
source§

impl<'a> MinimalWritableMessage for ResponseMessage<'a>

§

type Code = u8

§

type OptionNumber = u16

§

type AddOptionError = Error

Error returned when an option can not be added (eg. for lack of space, or because an option of a higher number or even the payload was already set)
§

type SetPayloadError = Error

Error returned when setting the payload (eg. for lack of space, or when a message of that type does not take a payload)
§

type UnionError = Error

Error type into which either of the other errors, as well as the errors for conversion of the Code and OptionNumber, can be .into()ed. Read more
source§

fn set_code(&mut self, code: Self::Code)

Set the CoAP code of the message (in a request, that is the request method)
source§

fn add_option( &mut self, number: Self::OptionNumber, value: &[u8] ) -> Result<(), Error>

Add an option to the message Read more
source§

fn set_payload(&mut self, data: &[u8]) -> Result<(), Error>

Set the payload to the message Read more
source§

fn set_from_message<M>(&mut self, msg: &M) -> Result<(), Self::UnionError>

Copy code, options and payload in from a readable message
source§

fn add_option_str( &mut self, number: Self::OptionNumber, value: &str ) -> Result<(), Self::AddOptionError>

Shortcut for add_option(self, number, value.as_bytes()). Read more
source§

fn add_option_uint<U>( &mut self, number: Self::OptionNumber, value: U ) -> Result<(), Self::AddOptionError>
where U: Unsigned + ToBytes,

Shortcut for add_option on a buffer containing the uint encoded value Read more
source§

fn convert_code_error(e: <Self::Code as Code>::Error) -> Self::UnionError

Auxiliary function for converting Self::Code::Error Read more
source§

fn convert_option_number_error( e: <Self::OptionNumber as OptionNumber>::Error ) -> Self::UnionError

Auxiliary function for converting Self::OptionNumber::Error Read more
source§

fn convert_add_option_error(e: Self::AddOptionError) -> Self::UnionError

Auxiliary function for converting Self::AddOptionError Read more
source§

fn convert_set_payload_error(e: Self::SetPayloadError) -> Self::UnionError

Auxiliary function for converting Self::SetPayloadError Read more
source§

impl<'a> MutableWritableMessage for ResponseMessage<'a>

source§

fn available_space(&self) -> usize

Number of bytes available for additional options, payload marker and payload
source§

fn payload_mut_with_len(&mut self, len: usize) -> Result<&mut [u8], Error>

Memory-map len bytes of the payload for writing Read more
source§

fn truncate(&mut self, len: usize) -> Result<(), Error>

Truncate an already-set payload to the given length; that payload must have been written to before using MinimalWritableMessage::set_payload, or with a suitable MutableWritableMessage::payload_mut_with_len call.
source§

fn mutate_options<F>(&mut self, callback: F)
where F: FnMut(Self::OptionNumber, &mut [u8]),

Apply a callback to all options in sequence Read more
source§

impl<'a> MutableWritableMessage for ResponseMessage<'a>

source§

fn available_space(&self) -> usize

Number of bytes available for additional options, payload marker and payload
source§

fn payload_mut(&mut self) -> &mut [u8]

👎Deprecated since 0.1.1: Use payload_mut_with_len instead
Legacy method for mutable access to the payload Read more
source§

fn truncate(&mut self, len: usize)

Truncate an already-set payload to the given length; that payload must have been written to before using MinimalWritableMessage::set_payload, or with a suitable MutableWritableMessage::payload_mut_with_len call.
source§

fn mutate_options<F>(&mut self, callback: F)
where F: FnMut(Self::OptionNumber, &mut [u8]),

Apply a callback to all options in sequence Read more
source§

fn payload_mut_with_len(&mut self, len: usize) -> &mut [u8]

Memory-map len bytes of the payload for writing Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for ResponseMessage<'a>

§

impl<'a> !Send for ResponseMessage<'a>

§

impl<'a> !Sync for ResponseMessage<'a>

§

impl<'a> Unpin for ResponseMessage<'a>

§

impl<'a> !UnwindSafe for ResponseMessage<'a>

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> IntoSwitch for T

source§

fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>

Consumes the IoPin returning a Switch of the appropriate ActiveLevel. Read more
source§

fn into_active_low_switch(self) -> Switch<Self, ActiveLow>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveLow>. Read more
source§

fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>
where Self: Sized,

Consumes the IoPin returning a Switch<IoPin, ActiveHigh>. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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.