pub struct WireView<'a> { /* private fields */ }Expand description
A borrowed view over one wire message’s top-level value. Holds no owned data and never
decodes the rest of the message; reads are in place. Open it with view_message.
Implementations§
Source§impl<'a> WireView<'a>
impl<'a> WireView<'a>
Sourcepub fn struct_field(&self, name: &str) -> Option<WireView<'a>>
pub fn struct_field(&self, name: &str) -> Option<WireView<'a>>
Read ONE field of an offset-table struct view (T_STRUCT_VIEW): scan the small
name table, then jump to the field’s value via the offset table — WITHOUT parsing
any other field, however large. The Cap’n Proto-class random-access read; returns
a sub-view you read with as_int/as_float/etc. None if not a view or no field.
Sourcepub fn as_i64_slice(&self) -> Option<&'a [i64]>
pub fn as_i64_slice(&self) -> Option<&'a [i64]>
Read an 8-byte-aligned i64 column (T_INTS_ALIGNED) as &[i64] with ZERO copy —
the in-place column read (the kernel-bypass / RDMA path: no per-element decode, no
memcpy). None if it is not an aligned column or the bytes are not 8-aligned in
this buffer (then the caller decodes/copies instead, still one memcpy).
Sourcepub fn as_f64_slice(&self) -> Option<&'a [f64]>
pub fn as_f64_slice(&self) -> Option<&'a [f64]>
Read an 8-byte-aligned f64 column (T_FLOATS_ALIGNED) as &[f64] with ZERO copy —
the float twin of as_i64_slice. None if it is not an
aligned float column or the bytes are not 8-aligned in this buffer (caller copies).
Sourcepub fn structs_fixed_i64_col(&self, fi: usize) -> Option<&'a [u8]>
pub fn structs_fixed_i64_col(&self, fi: usize) -> Option<&'a [u8]>
Read field fi of a COLUMNAR fixed struct list (T_STRUCTS whose every column is a
T_INTS_FIXED blob) as its contiguous little-endian i64 bytes — zero-copy, no per-cell
navigation and no materialization. Because the layout is columnar, ALL of field fi is
adjacent, so summing/scanning it is one CACHE-FRIENDLY contiguous pass — the columnar-
analytics win over a row-major reader’s strided walk (Cap’n Proto interleaves the fields).
None if the value is not a columnar all-fixed struct list, or fi is out of range.
Sourcepub fn as_byte_slice(&self) -> Option<&'a [u8]>
pub fn as_byte_slice(&self) -> Option<&'a [u8]>
Read a byte column (T_BYTES) as &[u8] with ZERO copy — binary data (hashes, file
chunks, crypto) read in place: no decode, no allocation, no i64 expansion, and
(unlike the i64/f64 columns) no alignment requirement, since a u8 slice is always
1-aligned. The first-class bytes/Data read that bit-packing can never offer.
None if this is not a byte column.
Sourcepub fn structs_len(&self) -> Option<usize>
pub fn structs_len(&self) -> Option<usize>
Row count of a record-list view (variable T_STRUCTS_VIEW or fixed T_STRUCTS_FVIEW),
or None if not one.
Sourcepub fn structs_row_field(&self, row: usize, name: &str) -> Option<WireView<'a>>
pub fn structs_row_field(&self, row: usize, name: &str) -> Option<WireView<'a>>
Read field name of row row in a record-list view (T_STRUCTS_VIEW) in O(1):
scan the shared name table once for the field index, jump via the row-offset table
to the row block, then via that row’s field-offset table to the value — NEVER parsing
the other rows or fields, however large the list. The Cap’n Proto-class random access
into a record list. Returns a sub-view (as_int/as_float/…). None if not a record
view, the row is out of range, or no such field.
Sourcepub fn structs_row_field_value(
&self,
row: usize,
name: &str,
) -> Option<RuntimeValue>
pub fn structs_row_field_value( &self, row: usize, name: &str, ) -> Option<RuntimeValue>
Read field name of row row as an owned value for EITHER record-list view: the variable
offset-table view (T_STRUCTS_VIEW) or the fixed-stride view (T_STRUCTS_FVIEW). Both are
O(1) random access — the fixed view by pure arithmetic (no offset tables). Numeric/bool
reads allocate nothing; a text read materializes the one string. The unified read the lazy
Await view backing uses, so a peer’s Send indexed (either layout) reads the same way.
None if this is not a record view, the row is out of range, or there is no such field.
Sourcepub fn decode(&self) -> Option<RuntimeValue>
pub fn decode(&self) -> Option<RuntimeValue>
Fully decode the ONE value this view points at (a cell / field / element) into an owned
RuntimeValue — the materialize-on-touch step a lazy reader runs after locating a field in
place. Decodes only this value, never the rest of the message; the bytes outside it stay
untouched. (Uses the ambient type registry, so it round-trips name-elided cells too.)
Sourcepub fn structs_schema(&self) -> Option<(String, Vec<String>, usize)>
pub fn structs_schema(&self) -> Option<(String, Vec<String>, usize)>
The schema of a record-list view (T_STRUCTS_VIEW): (type_name, field_names, row_count),
read from the shared header WITHOUT decoding a single row — so a lazy backing can carry the
schema + length while the row bytes stay un-decoded until a field is touched. None if this
is not a record-list view.
Sourcepub fn int_list_len(&self) -> Option<usize>
pub fn int_list_len(&self) -> Option<usize>
Element count of a homogeneous int list (T_INTS varint or T_INTS_FIXED).
Sourcepub fn int_list_get(&self, i: usize) -> Option<i64>
pub fn int_list_get(&self, i: usize) -> Option<i64>
Element i of an int list — O(1) + ZERO ALLOC for the fixed layout (seek to the
byte offset, read 8 bytes); O(i) scan for the varint layout, still no full decode.
Sourcepub fn float_list_len(&self) -> Option<usize>
pub fn float_list_len(&self) -> Option<usize>
Element count of a memcpy float list (T_FLOATS).
Sourcepub fn float_list_get(&self, i: usize) -> Option<f64>
pub fn float_list_get(&self, i: usize) -> Option<f64>
Element i of a memcpy float list — O(1), zero alloc.
Sourcepub fn structs_cursor(&self) -> Option<WireStructsCursor<'a>>
pub fn structs_cursor(&self) -> Option<WireStructsCursor<'a>>
Open a parse-ONCE bulk cursor over a record-list view (either layout). None if this is not
a record-list view. Use it to read a WHOLE list as fast as Cap’n Proto’s lazy reader:
structs_row_field_value re-parses the header on every call (fine for one read, O(n·f) for a
full scan), whereas the cursor parses the schema/tables once and every access is O(1).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for WireView<'a>
impl<'a> RefUnwindSafe for WireView<'a>
impl<'a> Send for WireView<'a>
impl<'a> Sync for WireView<'a>
impl<'a> Unpin for WireView<'a>
impl<'a> UnsafeUnpin for WireView<'a>
impl<'a> UnwindSafe for WireView<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.