Skip to main content

WireView

Struct WireView 

Source
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>

Source

pub fn as_int(&self) -> Option<i64>

The top-level value as an integer (T_INT).

Source

pub fn as_float(&self) -> Option<f64>

The top-level value as a float (T_FLOAT).

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.)

Source

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.

Source

pub fn as_bool(&self) -> Option<bool>

The top-level value as a bool.

Source

pub fn int_list_len(&self) -> Option<usize>

Element count of a homogeneous int list (T_INTS varint or T_INTS_FIXED).

Source

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.

Source

pub fn float_list_len(&self) -> Option<usize>

Element count of a memcpy float list (T_FLOATS).

Source

pub fn float_list_get(&self, i: usize) -> Option<f64>

Element i of a memcpy float list — O(1), zero alloc.

Source

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§

Source§

impl<'a> Clone for WireView<'a>

Source§

fn clone(&self) -> WireView<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for WireView<'a>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,