pub struct SdHeaderView<'a> { /* private fields */ }Expand description
Zero-copy view into an SD header payload.
Created by SdHeaderView::parse, which fully validates the SD header,
entries, and options upfront. This makes the entry and option iterators
infallible.
Implementations§
Source§impl<'a> SdHeaderView<'a>
impl<'a> SdHeaderView<'a>
Sourcepub fn parse(buf: &'a [u8]) -> Result<Self, Error>
pub fn parse(buf: &'a [u8]) -> Result<Self, Error>
Parse and fully validate an SD header from buf.
Validates:
- Buffer has enough data for flags +
entries_size+ entries +options_size+ options entries_sizeis a multiple ofENTRY_SIZE(16)- All entry type bytes are valid
- All options have valid types and lengths
§Errors
Returns an error if the buffer is too short, entries_size is not a multiple of 16,
any entry type byte is invalid, or any option has an invalid type or length.
Sourcepub fn options(&self) -> OptionIter<'a> ⓘ
pub fn options(&self) -> OptionIter<'a> ⓘ
Returns an iterator over the SD options.
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Returns the number of entries in this SD header.
Trait Implementations§
Source§impl<'a> Clone for SdHeaderView<'a>
impl<'a> Clone for SdHeaderView<'a>
Source§fn clone(&self) -> SdHeaderView<'a>
fn clone(&self) -> SdHeaderView<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for SdHeaderView<'a>
impl<'a> Debug for SdHeaderView<'a>
impl<'a> Copy for SdHeaderView<'a>
Auto Trait Implementations§
impl<'a> Freeze for SdHeaderView<'a>
impl<'a> RefUnwindSafe for SdHeaderView<'a>
impl<'a> Send for SdHeaderView<'a>
impl<'a> Sync for SdHeaderView<'a>
impl<'a> Unpin for SdHeaderView<'a>
impl<'a> UnsafeUnpin for SdHeaderView<'a>
impl<'a> UnwindSafe for SdHeaderView<'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