Skip to main content

ProjectCx

Trait ProjectCx 

Source
pub trait ProjectCx {
    // Required methods
    fn node_ref(&self, addr: NodeAddr) -> SerialValue;
    fn tree_ref(&self, id: TreeId) -> SerialValue;

    // Provided method
    fn tree(&self, tree: &NodeTree<Flm>) -> SerialValue { ... }
}
Expand description

The context through which a table writes node addresses, tree identifiers and trees when it serializes itself for inspection (Table::project).

A table that holds node addresses or tree identifiers calls these methods rather than writing an address itself, so that the serialized form of every table writes addresses the same way. The library’s implementation is TableProjection, which resolves each address against the trees it was built over.

A table that holds a synthesized value writes that tree in full through ProjectCx::tree, never by its identifier: value catch-up gives a synthesized value its identifier, numbered per stage call (StageCx::resolve_value), so the identifier means something only inside the stage call that brought the value up to date, and a reader of the serialized table could not resolve it. See TreeId.

See also crate::dump::project.

Required Methods§

Source

fn node_ref(&self, addr: NodeAddr) -> SerialValue

Writes a node address; the library’s implementation writes the node’s element name and source position, as element@line:col.

Source

fn tree_ref(&self, id: TreeId) -> SerialValue

Writes a tree identifier.

Provided Methods§

Source

fn tree(&self, tree: &NodeTree<Flm>) -> SerialValue

Writes a synthesized value that a table holds: the tree itself, in full. The library’s implementation writes its nodes as it writes any tree; the default implementation writes the tree’s plain text (plain_text).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§