Skip to documentation
SLOP

tiny.preserves.parsedEmbeddedOps

Reference tiny.preserves parsedEmbeddedOps

Defined in embedded_mod.

Returns one table whose equality, hash and order read each payload as a pointer to a Value and call eql, hash and compare on it.

Called byCallsNo direct callsprivate sourcelib.preserves.src.embeddedcheckParsedEmbeddedBindCloneAllocatio...test sourcelib.preserves.src.embeddedtest: parsed embedded clone and deini...embedded_modparsedEmbeddedOps
Static calls · unresolved targets: 0 · external targets: 0.

Source

Source: lib/preserves/src/embedded.zig:136

zig
/// Returns one table whose equality, hash and order read each payload as a pointer to a `Value` and/// call `eql`, `hash` and `compare` on it. The text parser, the JSON reader and `observeRecord`/// call it when they wrap a value as an embedded payload. The table is one constant per `Value`/// type, so payloads built by the text parser, the JSON reader and `observeRecord` compare with/// each other. `toText` checks for this table to print the payload as a value.pub fn parsedEmbeddedOps(comptime Value: type) *const SemanticOps {    const Impl = struct {        fn eql(a: *anyopaque, b: *anyopaque) bool {            const va: *const Value = @ptrCast(@alignCast(a));            const vb: *const Value = @ptrCast(@alignCast(b));            return va.*.eql(vb.*);        }        fn hash(ptr: *anyopaque) u64 {            const v: *const Value = @ptrCast(@alignCast(ptr));            return v.*.hash();        }        fn order(a: *anyopaque, b: *anyopaque) std.math.Order {            const va: *const Value = @ptrCast(@alignCast(a));            const vb: *const Value = @ptrCast(@alignCast(b));            return va.*.compare(vb.*);        }        const ops: SemanticOps = .{            .eql = &eql,            .hash = &hash,            .order = &order,        };    };    return &Impl.ops;}

Source: lib/preserves/src/root.zig:162

zig
pub const parsedEmbeddedOps = embedded_mod.parsedEmbeddedOps;

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433