pub struct BundleElementReader<'a> { /* private fields */ }Expand description
The structure used to iterate over a bundle’s elements, providing a developer-friendly API that automatically handle reply elements.
This structure can be obtained from Bundle::element_reader.
Implementations§
Source§impl<'a> BundleElementReader<'a>
impl<'a> BundleElementReader<'a>
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Return true if the current element is a request, this is just dependent of
the current position within the current packet.
Sourcepub fn next_id(&self) -> Option<u8>
pub fn next_id(&self) -> Option<u8>
Read the current element’s identifier. This call return the same result until you explicitly choose to go to the next element while reading the element
Sourcepub fn next_element(&mut self) -> Option<ElementReader<'_, 'a>>
pub fn next_element(&mut self) -> Option<ElementReader<'_, 'a>>
Read the current element, return a guard that you should use a codec to decode
the element depending on its type with. This is a simpler version to use over
standard read_element method because it handle reply elements for you.
Sourcepub fn read_element<E>(
&mut self,
config: &E::Config,
next: bool,
) -> BundleResult<BundleElement<E>>where
E: TopElement,
pub fn read_element<E>(
&mut self,
config: &E::Config,
next: bool,
) -> BundleResult<BundleElement<E>>where
E: TopElement,
Try to decode the current element using a given codec. You can choose to go
to the next element using the next argument.