pub struct BuiltGraph {
pub insns: Vec<Insn>,
pub rule_entry: Vec<InsnId>,
pub literal_data: Vec<u8>,
pub literal_offsets: Vec<u32>,
pub jump_tables: Vec<[u32; 256]>,
pub flag_mask_data: Vec<FlagMaskWord>,
pub flag_mask_offsets: Vec<u32>,
pub rule_names: Vec<&'static str>,
pub tag_names: Vec<&'static str>,
pub class_labels: Vec<&'static str>,
pub expected_labels: Vec<&'static str>,
pub field_names: Vec<&'static str>,
}Expand description
The fully-built grammar tables, ready to be handed to the parse engine.
Call as_graph to obtain a ParseGraph that
borrows from this value. Keep BuiltGraph alive for as long as the
ParseGraph (or any derived references) are in use.
Fields§
§insns: Vec<Insn>§rule_entry: Vec<InsnId>§literal_data: Vec<u8>§literal_offsets: Vec<u32>§jump_tables: Vec<[u32; 256]>§flag_mask_data: Vec<FlagMaskWord>§flag_mask_offsets: Vec<u32>§rule_names: Vec<&'static str>§tag_names: Vec<&'static str>§class_labels: Vec<&'static str>Labels for Insn::Class diagnostics; index 0 is the default “character class”.
expected_labels: Vec<&'static str>Labels for expect_label.
field_names: Vec<&'static str>Names for named child fields (indexed by FieldId); used by field_by_id / name resolution.
Implementations§
Source§impl BuiltGraph
impl BuiltGraph
Sourcepub fn as_graph(&self) -> ParseGraph
pub fn as_graph(&self) -> ParseGraph
Return a ParseGraph that borrows all tables from this BuiltGraph.
§Safety and lifetime
ParseGraph uses &'static [T] slices so it can be Copy and
embedded in static grammars. Here those references are produced by
casting the backing Vec pointers. You must ensure:
- The
BuiltGraphis not mutated afteras_graphis called, and - The
BuiltGraphoutlives every use of the returnedParseGraph(do not drop or move theBuiltGraphwhile the graph is in use).
Violating these conditions is undefined behavior. In typical usage
the BuiltGraph is stored in a variable that outlives the parse
call (e.g. let built = g.finish()?; let graph = built.as_graph();).