pub struct Cst {
pub uri: SmolStr,
pub block: Block,
pub errors: Vec<Error>,
pub status: AstStatus,
}Expand description
A struct representing a scope in a file. This CST is lossless, meaning it can be printed back to the code it was created from without losing any details.
Fields§
§uri: SmolStrThe path pointing to the file that this CST represents.
block: BlockThe block of code for this scope.
errors: Vec<Error>All syntactical errors in this CST.
status: AstStatusThe status of the CST. If it isn’t complete, it’s
better to not use it for operations which affect the source code, like formatting;
the output will have missing parts of the code.
Implementations§
Source§impl Cst
impl Cst
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether or not this Cst has errors.
Sourcepub fn try_print(&self) -> Result<String, PrintingError>
pub fn try_print(&self) -> Result<String, PrintingError>
Try printing the Cst back into source code.
§Errors
This’ll only fail if Cst.has_errors() returns true.
Trait Implementations§
Source§impl Ord for Cst
impl Ord for Cst
Source§impl PartialOrd for Cst
impl PartialOrd for Cst
impl Eq for Cst
impl StructuralPartialEq for Cst
Auto Trait Implementations§
impl Freeze for Cst
impl RefUnwindSafe for Cst
impl !Send for Cst
impl !Sync for Cst
impl Unpin for Cst
impl UnwindSafe for Cst
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