pub struct ResponseMessage<'b> {
message: PacketBuffer<'b>,
payload_written: Option<usize>,
}
Available on
riot_module_gcoap
only.Fields§
§message: PacketBuffer<'b>
Note that this is a slightly weird version of PacketBuffer, where opt_finish is never called, and .payload() perpetually reports the payload marker as part of the payload.
payload_written: Option<usize>
Implementations§
Trait Implementations§
Source§impl<'a> MinimalWritableMessage for ResponseMessage<'a>
impl<'a> MinimalWritableMessage for ResponseMessage<'a>
Source§type Code = u8
type Code = u8
See
Self::set_code()
Source§type OptionNumber = u16
type OptionNumber = u16
Source§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)
Source§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)
Source§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 promote_to_mutable_writable_message(&mut self) -> Option<&mut Self>
fn promote_to_mutable_writable_message(&mut self) -> Option<&mut Self>
Tries to obtain a MutableWritableMessage from self. 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 with_static_type_annotation(
&mut self,
) -> Option<RefMutWithStaticType<'_, Self>>
fn with_static_type_annotation( &mut self, ) -> Option<RefMutWithStaticType<'_, Self>>
Type ID of Self or a ’static version of Self Read more
Source§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
Auto Trait Implementations§
impl<'b> Freeze for ResponseMessage<'b>
impl<'b> RefUnwindSafe for ResponseMessage<'b>
impl<'b> !Send for ResponseMessage<'b>
impl<'b> !Sync for ResponseMessage<'b>
impl<'b> Unpin for ResponseMessage<'b>
impl<'b> !UnwindSafe for ResponseMessage<'b>
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
Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 20 bytes