Struct binary_layout::example::icmp_packet::View [−][src]
pub struct View<S> { /* fields omitted */ }The View struct defines the FieldView API. An instance of View wraps a storage (either borrowed or owned) and allows accessors for the layout fields.
Implementations
impl<S> View<S>[src]
impl<S> View<S>[src]pub fn new(storage: S) -> Self[src]
You can create views over a storage by calling View::new.
S is the type of underlying storage. It can be
- Immutable borrowed storage:
&[u8] - Mutable borrowed storage:
&mut [u8] - Owning storage: impl
AsRef<u8>(for example:Vec<u8>)
pub fn into_storage(self) -> S[src]
This destroys the view and returns the underlying storage back to you.
This is useful if you created an owning view (e.g. vased on Vec<u8>)
and now need the underlying Vec<u8> back.
pub fn into_packet_type(self) -> FieldView<S, packet_type>[src]
Destroy the View and return a field accessor to the packet_type field owning the storage. This is mostly useful for FieldView::extract
pub fn into_code(self) -> FieldView<S, code>[src]
Destroy the View and return a field accessor to the code field owning the storage. This is mostly useful for FieldView::extract
pub fn into_checksum(self) -> FieldView<S, checksum>[src]
Destroy the View and return a field accessor to the checksum field owning the storage. This is mostly useful for FieldView::extract
pub fn into_rest_of_header(self) -> FieldView<S, rest_of_header>[src]
Destroy the View and return a field accessor to the rest_of_header field owning the storage. This is mostly useful for FieldView::extract
pub fn into_data_section(self) -> FieldView<S, data_section>[src]
Destroy the View and return a field accessor to the data_section field owning the storage. This is mostly useful for FieldView::extract
impl<S: AsRef<[u8]>> View<S>[src]
impl<S: AsRef<[u8]>> View<S>[src]pub fn packet_type(&self) -> FieldView<&[u8], packet_type>[src]
Return a FieldView with read access to the packet_type field
pub fn code(&self) -> FieldView<&[u8], code>[src]
Return a FieldView with read access to the code field
pub fn checksum(&self) -> FieldView<&[u8], checksum>[src]
Return a FieldView with read access to the checksum field
pub fn rest_of_header(&self) -> FieldView<&[u8], rest_of_header>[src]
Return a FieldView with read access to the rest_of_header field
pub fn data_section(&self) -> FieldView<&[u8], data_section>[src]
Return a FieldView with read access to the data_section field
impl<S: AsMut<[u8]>> View<S>[src]
impl<S: AsMut<[u8]>> View<S>[src]pub fn packet_type_mut(&mut self) -> FieldView<&mut [u8], packet_type>[src]
Return a FieldView with write access to the packet_type field
pub fn code_mut(&mut self) -> FieldView<&mut [u8], code>[src]
Return a FieldView with write access to the code field
pub fn checksum_mut(&mut self) -> FieldView<&mut [u8], checksum>[src]
Return a FieldView with write access to the checksum field
pub fn rest_of_header_mut(&mut self) -> FieldView<&mut [u8], rest_of_header>[src]
Return a FieldView with write access to the rest_of_header field
pub fn data_section_mut(&mut self) -> FieldView<&mut [u8], data_section>[src]
Return a FieldView with write access to the data_section field
Auto Trait Implementations
impl<S> RefUnwindSafe for View<S> where
S: RefUnwindSafe,
impl<S> RefUnwindSafe for View<S> where
S: RefUnwindSafe, impl<S> UnwindSafe for View<S> where
S: UnwindSafe,
impl<S> UnwindSafe for View<S> where
S: UnwindSafe,