//! representation for messages in libcoap-rs ([CoapMessage]) as well as builders that simplify the
//! process of creating requests and responses and setting the appropriate options ([CoapRequest]
coap_add_data, coap_add_data_large_request, coap_add_optlist_pdu, coap_add_token, coap_delete_optlist,
coap_delete_pdu, coap_get_data, coap_insert_optlist, coap_new_optlist, coap_opt_length, coap_opt_t, coap_opt_value,
coap_option_iterator_init, coap_option_next, coap_option_num_t, coap_optlist_t, coap_pdu_get_code,
coap_pdu_get_mid, coap_pdu_get_token, coap_pdu_get_type, coap_pdu_init, coap_pdu_set_code, coap_pdu_set_type,
Block, CoapMatch, CoapMessageCode, CoapMessageType, CoapOptionNum, CoapOptionType, ContentFormat, ETag, Echo,
HopLimit, MaxAge, NoResponse, Observe, Oscore, ProxyScheme, ProxyUri, RequestTag, Size, UriHost, UriPath,
decode_var_len_u16, decode_var_len_u32, decode_var_len_u8, encode_var_len_u16, encode_var_len_u32,
pub(crate) unsafe fn from_optlist_entry(optlist_entry: &coap_optlist_t) -> Result<Self, OptionValueError> {
let value = Vec::from(std::slice::from_raw_parts(optlist_entry.data, optlist_entry.length));
fn from_type_value(type_: coap_option_num_t, value: Vec<u8>) -> Result<Self, OptionValueError> {
/// Clear the list of options that were added to this message using [add_option()](CoapMessageCommon::add_option()).
/// Returns the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
/// Sets the CoAP message type (confirmable, non-confirmable, acknowledgement, rst) of this message.
/// To determine whether the message is a request or response, use [CoapMessageCode::try_from()]
pub unsafe fn from_raw_pdu(raw_pdu: *const coap_pdu_t) -> Result<CoapMessage, MessageConversionError> {
MessageConversionError::InvalidOptionValue(CoapOptionType::try_from(option_iter.number).ok(), e)
/// Converts this message into a raw PDU suitable for sending using the raw [coap_send()](libcoap_sys::coap_send())
/// The caller is responsible for freeing the returned PDU, either by calling [coap_send()](libcoap_sys::coap_send()) or
.map_err(|e| MessageConversionError::InvalidOptionValue(CoapOptionType::try_from(optnum).ok(), e))?;
unsafe extern "C" fn large_data_cleanup_handler(_session: *mut coap_session_t, app_ptr: *mut c_void) {