logos.lang.writ.static_view

Module lang · package logos-lang

Types

structSView2

struct SView2

Borrowed UTF-8 bytes of a blob string.

Implements: Copy

Fields

len: u64

Length in bytes.

ptr: *const u8

Pointer to the first byte of the UTF-8 data (borrowed from the blob).

structWView2

struct WView2

Read view over a writ rodata blob. base is the first blob byte (the DocumentHeader, holding the root AnyVal at offset 0). For a WritStatic the blob ptr already points past the 8-byte size prefix, so base = hs.ptr.

Implements: Copy

Fields

base: *const u8

First blob byte (the DocumentHeader).

Methods

fn array_get(self: WView2, v: WAny, idx: u64) -> WAny

Returns element idx of an array node; null/non-ref → null WAny.

fn array_len(self: WView2, v: WAny) -> u64

Returns the length of an array node (v = Ref to WArray<WAny>). Null/non-ref → 0.

fn get_bool(self: WView2, v: WAny) -> bool

Returns v as bool. Non-Pod → false.

fn get_i64(self: WView2, v: WAny) -> i64

Returns v as i64; alias for get_int.

fn get_int(self: WView2, v: WAny) -> i64

Returns v as i64 — reads either an inline Pod int or a boxed zone W_I64/W_U64. Non-int → 0.

fn get_str_view(self: WView2, v: WAny) -> SView2

Returns borrowed UTF-8 bytes of a string node (Ref to WString); empty if null/non-ref.

fn get_u64(self: WView2, v: WAny) -> u64

Returns v as u64 (inline Pod int or boxed zone int). Non-int → 0.

fn map_get(self: WView2, node: WAny, key: &[u8]) -> WAny

Reads a string-keyed ObjectMap field: node (Ref to WMap<WString,WAny>) by key. A null/non-ref node, or an absent key, yields a null WAny.

fn root(self: WView2) -> WAny

Returns the document root WAny. The at-rest root word at base+0 is self-relative; this materializes it to value form.

fn tiny_map_get(self: WView2, node: WAny, key: u8) -> WAny

Reads a u8-keyed TinyObjectMap field (the AST/schema flavour: WMap<Wu6,WAny>). A null/non-ref node, or an absent key, yields a null WAny.

Functions

fnwany_from_word

fn wany_from_word(w: i64) -> WAny

Reconstructs a value-form WAny from its raw word (WAny::raw()). Lets callers stash a node handle as a plain i64 field (sidestepping the borrow-checker’s conservative treatment of the Ref raw-ptr) and rebuild it on use. A value-form Ref’s word IS its absolute ptr (low bit 0); Pod has low bit 1; word 0 = null.

fnwview2_from_ptr

fn wview2_from_ptr(ptr: *const u8) -> WView2

Builds a reader from a rodata blob pointer (WritStatic.ptr).