Skip to main content

Value

Enum Value 

Source
pub enum Value {
Show 30 variants Unit, Bool(bool), Int(i64), Float(f64), Length(Length), Str(String), List(Vec<Value>), Tuple(Vec<Value>), Ctor(String, Option<Box<Value>>), Record(BTreeMap<String, Value>), Context(Box<Context>), InlineText { elems: Rc<Vec<IText>>, env: Env, }, BlockText { elems: Rc<Vec<BText>>, env: Env, }, MathText { elems: Rc<Vec<MathElem>>, env: Env, }, Math(Rc<Vec<Math>>), MathBoxes(Rc<Vec<Math>>), Ref(Rc<RefCell<Value>>), InlineBoxes(Vec<HorzBox>), BlockBoxes(Vec<VertBox>), Image(ImageId), Document(Rc<DocumentValue>), CompiledClosure { opt_labels: Vec<String>, body: CompiledExpr, env: Env, }, Code { body: CompiledExpr, env: Env, }, Prim { def: &'static PrimDef, applied: Vec<Value>, }, PrePath(PrePath), Path(Path), Graphics(GraphicsElem), Font(FontKey), TextInfo(TextInfo), Hyphenation(HyphenLang),
}

Variants§

§

Unit

§

Bool(bool)

§

Int(i64)

§

Float(f64)

§

Length(Length)

§

Str(String)

§

List(Vec<Value>)

§

Tuple(Vec<Value>)

§

Ctor(String, Option<Box<Value>>)

A variant constructor value, optionally carrying a payload (None / Some 3).

§

Record(BTreeMap<String, Value>)

§

Context(Box<Context>)

§

InlineText

Quoted inline text with its captured environment (InputHorzWithEnvironment). elems is the COMPILED element tree (crate::quoted): command names and embedded expressions were resolved at compile time, so nothing here is looked up by name at layout time — the environment is still captured because a compiled node resolves its locals against the environment it runs in.

Fields

§elems: Rc<Vec<IText>>
§env: Env
§

BlockText

Quoted block text with its captured environment.

Fields

§elems: Rc<Vec<BText>>
§env: Env
§

MathText

Quoted math text with its captured environment (mirrors InlineText/BlockText); typesetting is deferred, so this is carried opaquely for now.

Fields

§elems: Rc<Vec<MathElem>>
§env: Env
§

Math(Rc<Vec<Math>>)

The faithful math value — what every math-* primitive (math-char, math-concat, math-sup, …) builds and consumes, as opposed to MathText’s elaborator-fused literal form. A math value is always a sequence of atoms (mirroring upstream MathValue of math list, types.cppo.ml:888 — each Math here is one already-classed atom, not a further list), so math-concat is a plain Vec append and math-group/math-sup/… each wrap the whole inner Vec as ONE new atom. Both this and MathText type as "math" — a ${…} literal and a math-*-primitive-built value are interchangeable wherever a math-typed argument is expected (see primitives.rs’s as_math, which accepts either).

§

MathBoxes(Rc<Vec<Math>>)

math-boxes (V0_1 only) — the evaluated math tree read-math produces, wrapping the SAME Math atom tree Value::Math uses so every layout/primitive helper is shared unchanged. Distinct from Value::Math: no V0_0 primitive ever produces or consumes this variant, and no V0_1 primitive ever produces Value::Math — kept apart so a V0_1 program can’t silently pass a math-text where math-boxes is required (as_math_boxes is strict).

§

Ref(Rc<RefCell<Value>>)

A mutable cell (let-mutable’s binding; v0.0.6’s Location/store entry). This port uses a directly-shared RefCell instead of an indirection through a separate store table.

§

InlineBoxes(Vec<HorzBox>)

inline-boxes (the Horz base constant).

§

BlockBoxes(Vec<VertBox>)

block-boxes (the Vert base constant).

§

Image(ImageId)

image (load-image’s result): an index into the document-wide image table (Interp::images), moved into DocumentValue::images once page-break packages the final document. Carrying just the index (not the decoded bytes) keeps this value cheap to clone, same as Value::Ref’s Rc.

§

Document(Rc<DocumentValue>)

§

CompiledClosure

A closure. Its body is an already-compiled CompiledExpr, run directly by crate::eval::Interp::apply — the only closure representation.

Fields

§opt_labels: Vec<String>

SATySFi 0.1 labeled optional LABELS, in binder order; empty for every 0.0.6-built closure. Each receives an option-typed value at application (Some v when the call supplies ?(label = v), None otherwise). Only the labels survive — a call site matches against them by name — while the binders they bind to are slots 0..n of the frame application pushes, so their names are gone.

§body: CompiledExpr

The positional parameter’s slot is opt_labels.len(), immediately after the optional binders, so it needs no field of its own.

§env: Env
§

Code

&e — a quoted expression awaiting the next stage, with the environment it was quoted in. Typed code ty (crate::types::MonoType::Code).

The same shape as Value::CompiledClosure minus a parameter, and for the same reason: this evaluator compiles to slot-indexed closures, so a fragment cannot be carried as a re-compilable syntax tree the way upstream’s code_value is — its variable references are already bound to the frames of the scope it was written in. Carrying the compiled body with its environment keeps those references meaning what they said, which is what ~ then forces.

Fields

§body: CompiledExpr
§env: Env
§

Prim

A (possibly partially applied) native primitive.

Fields

§def: &'static PrimDef
§applied: Vec<Value>
§

PrePath(PrePath)

pre-path (start-path/line-to’s result).

§

Path(Path)

path (terminate-path/close-with-line’s result).

§

Graphics(GraphicsElem)

graphics — one resolved drawing element (fill/stroke’s result); a graphics list is just Value::List of these, same as upstream.

§

Font(FontKey)

font (V0_1 only; upstream saphe-split’s BCFontKey of FontKey.t) — an OPAQUE handle on one loaded face, already resolved through the metrics provider’s font store at the point the value was minted. Upstream mints one per files[] entry of a FONT ENVELOPE (envelopeChecker.ml’s check_font_envelope, evaluating the internal LoadSingleFont{path}/LoadCollectionFont{path;index} node to BCFontKey); this port’s bundled 0.1 font envelopes are .satyh stand-ins that mint theirs through the LOCAL load-single-font primitive instead.

Deliberately carries NO abbrev/name/path: it is a store INDEX, the same thing upstream’s FontKey.t is, and nothing in the language can map it back. That opacity is load-bearing for the cross-version boundary: 0.0.6’s font-consuming primitives want an ABBREV naming a row of dist/hash/fonts.satysfi-hash, and no such name is recoverable from a key.

§

TextInfo(TextInfo)

text-info (the text-mode-context sliver).

§

Hyphenation(HyphenLang)

hyphenation (load-hyphenation-dictionary’s result) — the tag set-hyphenation-dictionary writes into Context::hyphen_dictionary, naming which dictionary was requested.

Implementations§

Source§

impl Value

Source

pub fn type_name(&self) -> &'static str

A short type name for error messages.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

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 Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Value

§

impl !Send for Value

§

impl !Sync for Value

§

impl !UnwindSafe for Value

§

impl Freeze for Value

§

impl Unpin for Value

§

impl UnsafeUnpin for Value

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

Source§

fn clone(&self) -> T

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

impl<T> Debug for T
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

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

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

Source§

fn vzip(self) -> V