pub struct HeaderSet { /* private fields */ }
Expand description
Maintains a collection of OBEX Headers that are sent & received in an OBEX packet. See OBEX 1.5 Section 3.4 for the ordering requirements and definitions of the supported Header types.
Implementations§
Source§impl HeaderSet
impl HeaderSet
pub fn new() -> Self
pub fn from_headers(headers: Vec<Header>) -> Result<Self, Error>
pub fn from_header(header: Header) -> Self
pub fn is_empty(&self) -> bool
pub fn contains_header(&self, id: &HeaderIdentifier) -> bool
pub fn get(&self, id: &HeaderIdentifier) -> Option<&Header>
Sourcepub fn add(&mut self, header: Header) -> Result<(), Error>
pub fn add(&mut self, header: Header) -> Result<(), Error>
Attempts to add the header
to the HeaderSet.
Returns Ok
if the header was successfully added, Error if the header is incompatible with
the existing headers in the set or if a different value already exists for the requested
header
.
Sourcepub fn try_append(&mut self, other: HeaderSet) -> Result<(), Error>
pub fn try_append(&mut self, other: HeaderSet) -> Result<(), Error>
Attempts to combine HeaderSet
s together by modifying the current collection. Returns Ok on
success, Error otherwise.
Sourcepub fn remove_body(&mut self, final_: bool) -> Result<Vec<u8>, Error>
pub fn remove_body(&mut self, final_: bool) -> Result<Vec<u8>, Error>
Removes and returns the payload for the Body Header from the set.
If final_
is set, then the EndOfBody header payload is returned.
Returns Error if the expected Header is not present in the collection.
Sourcepub fn remove(&mut self, id: &HeaderIdentifier) -> Option<Header>
pub fn remove(&mut self, id: &HeaderIdentifier) -> Option<Header>
Removes and returns the specified Header from the collection. Returns None if the Header is not present.
Sourcepub fn try_add_srm(
&mut self,
local: SingleResponseMode,
) -> Result<SingleResponseMode, Error>
pub fn try_add_srm( &mut self, local: SingleResponseMode, ) -> Result<SingleResponseMode, Error>
Attempts to add the SingleResponseMode
Header to the current HeaderSet
.
local
is the supported mode of the local transport.
Returns the SingleResponseMode value that was added to the set on success, Error if it
couldn’t be added or there was an incompatibility between the current set and local
preferences.
pub fn try_add_connection_id( &mut self, id: &Option<ConnectionIdentifier>, ) -> Result<(), Error>
Trait Implementations§
Source§impl Encodable for HeaderSet
impl Encodable for HeaderSet
impl StructuralPartialEq for HeaderSet
Auto Trait Implementations§
impl Freeze for HeaderSet
impl RefUnwindSafe for HeaderSet
impl Send for HeaderSet
impl Sync for HeaderSet
impl Unpin for HeaderSet
impl UnwindSafe for HeaderSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)