Struct riot_wrappers::coap_message::ResponseMessage
source · pub struct ResponseMessage<'a> { /* private fields */ }
Available on
riot_module_gcoap
only.Implementations§
source§impl<'a> ResponseMessage<'a>
impl<'a> ResponseMessage<'a>
Trait Implementations§
source§impl<'a> MinimalWritableMessage for ResponseMessage<'a>
impl<'a> MinimalWritableMessage for ResponseMessage<'a>
type Code = u8
type OptionNumber = u16
fn set_code(&mut self, code: Self::Code)
source§fn add_option(&mut self, number: Self::OptionNumber, value: &[u8])
fn add_option(&mut self, number: Self::OptionNumber, value: &[u8])
Add an option to the message Read more
fn set_payload(&mut self, data: &[u8])
source§fn set_from_message<M>(&mut self, msg: &M)where
M: ReadableMessage,
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)
fn add_option_str(&mut self, number: Self::OptionNumber, value: &str)
Shortcut for
add_option(self, number, value.as_bytes())
. Read moresource§fn add_option_uint<U>(&mut self, number: Self::OptionNumber, value: U)where
U: Ux,
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 moresource§impl<'a> MinimalWritableMessage for ResponseMessage<'a>
impl<'a> MinimalWritableMessage for ResponseMessage<'a>
§type Code = u8
type Code = u8
See
Self::set_code()
§type OptionNumber = u16
type OptionNumber = u16
§type AddOptionError = Error
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
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
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 moresource§fn set_code(&mut self, code: Self::Code)
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>
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>
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>where
M: ReadableMessage + WithSortedOptions,
fn set_from_message<M>(&mut self, msg: &M) -> Result<(), Self::UnionError>where
M: ReadableMessage + WithSortedOptions,
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>
fn add_option_str( &mut self, number: Self::OptionNumber, value: &str ) -> Result<(), Self::AddOptionError>
Shortcut for
add_option(self, number, value.as_bytes())
. Read moresource§fn add_option_uint<U>(
&mut self,
number: Self::OptionNumber,
value: U
) -> Result<(), Self::AddOptionError>
fn add_option_uint<U>( &mut self, number: Self::OptionNumber, value: U ) -> Result<(), Self::AddOptionError>
Shortcut for
add_option
on a buffer containing the uint encoded value Read moresource§fn convert_code_error(e: <Self::Code as Code>::Error) -> Self::UnionError
fn convert_code_error(e: <Self::Code as Code>::Error) -> Self::UnionError
Auxiliary function for converting
Self::Code::Error
Read moresource§fn convert_option_number_error(
e: <Self::OptionNumber as OptionNumber>::Error
) -> Self::UnionError
fn convert_option_number_error( e: <Self::OptionNumber as OptionNumber>::Error ) -> Self::UnionError
Auxiliary function for converting
Self::OptionNumber::Error
Read moresource§fn convert_add_option_error(e: Self::AddOptionError) -> Self::UnionError
fn convert_add_option_error(e: Self::AddOptionError) -> Self::UnionError
Auxiliary function for converting
Self::AddOptionError
Read moresource§fn convert_set_payload_error(e: Self::SetPayloadError) -> Self::UnionError
fn convert_set_payload_error(e: Self::SetPayloadError) -> Self::UnionError
Auxiliary function for converting
Self::SetPayloadError
Read moresource§impl<'a> MutableWritableMessage for ResponseMessage<'a>
impl<'a> MutableWritableMessage for ResponseMessage<'a>
source§fn available_space(&self) -> usize
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>
fn payload_mut_with_len(&mut self, len: usize) -> Result<&mut [u8], Error>
Memory-map
len
bytes of the payload for writing Read moresource§fn truncate(&mut self, len: usize) -> Result<(), Error>
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)
fn mutate_options<F>(&mut self, callback: F)
Apply a callback to all options in sequence Read more
source§impl<'a> MutableWritableMessage for ResponseMessage<'a>
impl<'a> MutableWritableMessage for ResponseMessage<'a>
source§fn available_space(&self) -> usize
fn available_space(&self) -> usize
Number of bytes available for additional options, payload marker and payload
source§fn payload_mut(&mut self) -> &mut [u8]
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)
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)
fn mutate_options<F>(&mut self, callback: F)
Apply a callback to all options in sequence 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> 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