pub struct PureFile {
pub attrs: Vec<PureAttribute>,
pub items: Vec<PureItem>,
}Expand description
A complete Rust source file (pure, no spans).
Fields§
§attrs: Vec<PureAttribute>Attributes on the file (e.g., #![allow(...)]).
items: Vec<PureItem>Items in the file.
Implementations§
Source§impl PureFile
impl PureFile
Sourcepub fn from_source(source: &str) -> SourceResult<Self>
pub fn from_source(source: &str) -> SourceResult<Self>
Parse source code directly into PureFile.
Source§impl PureFile
impl PureFile
Sourcepub fn to_syn_file(&self) -> Result<File, ToSynError>
pub fn to_syn_file(&self) -> Result<File, ToSynError>
Convert to syn::File for code generation.
Sourcepub fn to_source(&self) -> Result<String, ToSynError>
pub fn to_source(&self) -> Result<String, ToSynError>
Generate source code string.
Returns formatted source code using prettyplease. Falls back to quote-based stringification if prettyplease panics.
Note: This method does NOT run rustfmt. For final output, use
format_files_with_rustfmt() to batch-format written files.
Trait Implementations§
impl Eq for PureFile
impl Send for PureFile
impl StructuralPartialEq for PureFile
impl Sync for PureFile
Auto Trait Implementations§
impl Freeze for PureFile
impl RefUnwindSafe for PureFile
impl Unpin for PureFile
impl UnsafeUnpin for PureFile
impl UnwindSafe for PureFile
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