#[non_exhaustive]pub struct Envelope {
pub result: ResultBlock,
pub meta: Map<String, Value>,
pub clusters: Vec<Cluster>,
pub page: Page,
pub cache: EnvelopeCache,
}Expand description
Top-level envelope (§7).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.result: ResultBlockResult-level metadata: totals, axes, detection report.
meta: Map<String, Value>Free-form metadata block. Defaults to empty.
clusters: Vec<Cluster>Top-level clusters (root children).
page: PagePage block — populated when --cluster is set, empty otherwise.
cache: EnvelopeCacheOptional source records cache used when re-processing a saved envelope. Empty for hand-authored/minimal envelopes.
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn looks_like_envelope(prefix: &[u8]) -> bool
pub fn looks_like_envelope(prefix: &[u8]) -> bool
§9: detect whether a byte prefix starts with a face envelope.
The check walks the prefix as a structural scan: skip BOM and
leading whitespace, require an opening {, then look at the
top-level keys (depth-1 strings). If both result and
clusters appear before the prefix runs out, return true.
This is intentionally a structural scan, not a full
serde_json::from_slice, so the §9 self-consume detection
works on envelopes larger than the sniff prefix (the prefix is
only ~4 KiB; an envelope’s meta block alone may exceed that).
A truncated prefix that contains both target keys at depth 1 is
enough to classify the input.
Returns false for any input that does not start with a JSON
object (JSONL streams, JSON arrays, CSV/TSV, scalars).
§Examples
use face_core::Envelope;
let env = br#"{"result":{"input_total":0},"clusters":[]}"#;
assert!(Envelope::looks_like_envelope(env));
let arr = b"[1, 2, 3]";
assert!(!Envelope::looks_like_envelope(arr));