pub struct Location<'t, C>where
C: CustomTraversal,{
pub start_offset: usize,
pub end_offset: usize,
pub ancestor_path: &'t [ContainerState<C>],
}
Expand description
The Location of the encoding - capturing both the byte offset in the payload, and also the container-path-based location in the SBOR value model.
Fields§
§start_offset: usize
An offset in the payload, where this Location
starts.
The meaning of this offset depends on the context of the event, eg:
- For ContainerStart, this is the start of the value
- For ContainerEnd, this is the start of the value
- For DecodeError, this is the location where the error occurred
end_offset: usize
An offset in the payload, where this Location
ends (could be the same as start_offset).
The meaning of this offset depends on the context of the event, eg:
- For ContainerStart, this is the end of the header
- For ContainerEnd, this is the end of the whole container value
- For DecodeError, this is the location where the error occurred
ancestor_path: &'t [ContainerState<C>]
The path of containers from the root to the current value. If the event is ContainerStart/ContainerEnd, this does not include the newly started/ended container.
Implementations§
source§impl<'t, C> Location<'t, C>where
C: CustomTraversal,
impl<'t, C> Location<'t, C>where
C: CustomTraversal,
sourcepub fn get_start_offset_of_value_body(&self) -> usize
pub fn get_start_offset_of_value_body(&self) -> usize
Gives the offset of the start of the value body (ignoring the value kind byte). The result is only valid if this location corresponds to a ContainerStart/TerminalValue/ContainerEnd event.
Trait Implementations§
source§impl<'t, C> PartialEq for Location<'t, C>where
C: PartialEq + CustomTraversal,
impl<'t, C> PartialEq for Location<'t, C>where
C: PartialEq + CustomTraversal,
impl<'t, C> Copy for Location<'t, C>where
C: Copy + CustomTraversal,
impl<'t, C> Eq for Location<'t, C>where
C: Eq + CustomTraversal,
impl<'t, C> StructuralPartialEq for Location<'t, C>where
C: CustomTraversal,
Auto Trait Implementations§
impl<'t, C> RefUnwindSafe for Location<'t, C>
impl<'t, C> Send for Location<'t, C>
impl<'t, C> Sync for Location<'t, C>
impl<'t, C> Unpin for Location<'t, C>
impl<'t, C> UnwindSafe for Location<'t, C>
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.