pub struct DocumentConstructor { /* private fields */ }Implementations§
Source§impl DocumentConstructor
impl DocumentConstructor
pub fn new() -> Self
pub fn current_node_id(&self) -> NodeId
pub fn current_node(&self) -> &Node
pub fn current_node_mut(&mut self) -> &mut Node
pub fn current_path(&self) -> &[PathSegment]
pub fn document(&self) -> &EureDocument
pub fn document_mut(&mut self) -> &mut EureDocument
pub fn finish(self) -> EureDocument
Source§impl DocumentConstructor
impl DocumentConstructor
Sourcepub fn begin_scope(&mut self) -> Scope
pub fn begin_scope(&mut self) -> Scope
Begin a new scope. Returns a scope handle that must be passed to end_scope.
Scopes must be ended in LIFO order (most recent first).
Sourcepub fn end_scope(&mut self, scope: Scope) -> Result<(), ScopeError>
pub fn end_scope(&mut self, scope: Scope) -> Result<(), ScopeError>
End a scope, restoring the constructor to the state when the scope was created. Returns an error if the scope is not the most recent outstanding scope.
Navigate to a child node by path segment. Creates the node if it doesn’t exist.
Sourcepub fn require_hole(&self) -> Result<(), InsertError>
pub fn require_hole(&self) -> Result<(), InsertError>
Validate that the current node is a Hole (unbound). Use this before binding a value to ensure the node hasn’t already been assigned.
Sourcepub fn bind_hole(
&mut self,
label: Option<Identifier>,
) -> Result<(), InsertError>
pub fn bind_hole( &mut self, label: Option<Identifier>, ) -> Result<(), InsertError>
Bind a hole (optionally labeled) to the current node.
Sourcepub fn bind_primitive(
&mut self,
value: PrimitiveValue,
) -> Result<(), InsertError>
pub fn bind_primitive( &mut self, value: PrimitiveValue, ) -> Result<(), InsertError>
Bind a primitive value to the current node. Error if already bound.
Sourcepub fn bind_from(
&mut self,
value: impl Into<PrimitiveValue>,
) -> Result<(), InsertError>
pub fn bind_from( &mut self, value: impl Into<PrimitiveValue>, ) -> Result<(), InsertError>
Bind a value to the current node using Into<PrimitiveValue>.
This is a convenience method for use with the eure! macro.
It accepts any type that implements Into<PrimitiveValue>.
Sourcepub fn bind_empty_map(&mut self) -> Result<(), InsertError>
pub fn bind_empty_map(&mut self) -> Result<(), InsertError>
Bind an empty map to the current node. Error if already bound.
Sourcepub fn bind_empty_array(&mut self) -> Result<(), InsertError>
pub fn bind_empty_array(&mut self) -> Result<(), InsertError>
Bind an empty array to the current node. Error if already bound.
Sourcepub fn bind_empty_tuple(&mut self) -> Result<(), InsertError>
pub fn bind_empty_tuple(&mut self) -> Result<(), InsertError>
Bind an empty tuple to the current node. Error if already bound.