pub struct SourceDocument {
pub document: EureDocument,
pub sources: Vec<EureSource>,
pub root: SourceId,
pub multiline_arrays: HashSet<NodeId>,
}Expand description
A document with source structure metadata.
Combines semantic data (EureDocument) with source AST information
for round-trip conversions, preserving the exact source structure.
Fields§
§document: EureDocumentThe semantic data (values, structure)
sources: Vec<EureSource>Arena of all EureSource blocks
root: SourceIdRoot source index (always 0)
multiline_arrays: HashSet<NodeId>Array nodes that should be formatted multi-line (even without trivia)
Implementations§
Source§impl SourceDocument
impl SourceDocument
Sourcepub fn new(document: EureDocument, sources: Vec<EureSource>) -> Self
pub fn new(document: EureDocument, sources: Vec<EureSource>) -> Self
Create a new source document with the given document and sources.
Sourcepub fn mark_multiline_array(&mut self, node_id: NodeId)
pub fn mark_multiline_array(&mut self, node_id: NodeId)
Mark an array node as needing multi-line formatting.
Sourcepub fn is_multiline_array(&self, node_id: NodeId) -> bool
pub fn is_multiline_array(&self, node_id: NodeId) -> bool
Check if an array node should be formatted multi-line.
Sourcepub fn document(&self) -> &EureDocument
pub fn document(&self) -> &EureDocument
Get a reference to the document.
Sourcepub fn document_mut(&mut self) -> &mut EureDocument
pub fn document_mut(&mut self) -> &mut EureDocument
Get a mutable reference to the document.
Sourcepub fn root_source(&self) -> &EureSource
pub fn root_source(&self) -> &EureSource
Get the root EureSource.
Sourcepub fn source(&self, id: SourceId) -> &EureSource
pub fn source(&self, id: SourceId) -> &EureSource
Get a reference to an EureSource by ID.
Sourcepub fn source_mut(&mut self, id: SourceId) -> &mut EureSource
pub fn source_mut(&mut self, id: SourceId) -> &mut EureSource
Get a mutable reference to an EureSource by ID.
Trait Implementations§
Source§impl Clone for SourceDocument
impl Clone for SourceDocument
Source§fn clone(&self) -> SourceDocument
fn clone(&self) -> SourceDocument
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SourceDocument
impl RefUnwindSafe for SourceDocument
impl Send for SourceDocument
impl Sync for SourceDocument
impl Unpin for SourceDocument
impl UnwindSafe for SourceDocument
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more