pub struct Codemap {
pub path: PathBuf,
pub language: Language,
pub imports: SmallVec<[Import; 8]>,
pub declarations: SmallVec<[Declaration; 16]>,
pub token_count: usize,
pub parse_error: Option<String>,
}Expand description
Extracted codemap from a source file.
Fields§
§path: PathBufPath to the source file.
language: LanguageDetected language.
imports: SmallVec<[Import; 8]>Import statements.
declarations: SmallVec<[Declaration; 16]>Extracted declarations.
token_count: usizeToken count of rendered codemap.
parse_error: Option<String>Parse error if extraction failed.
Implementations§
Source§impl Codemap
impl Codemap
Sourcepub fn with_error(path: PathBuf, language: Language, error: String) -> Self
pub fn with_error(path: PathBuf, language: Language, error: String) -> Self
Create a codemap with a parse error.
Sourcepub fn public_only(&self) -> impl Iterator<Item = &Declaration>
pub fn public_only(&self) -> impl Iterator<Item = &Declaration>
Filter to only public declarations.
Sourcepub fn declaration_count(&self) -> usize
pub fn declaration_count(&self) -> usize
Count total declarations including nested.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Codemap
impl RefUnwindSafe for Codemap
impl Send for Codemap
impl Sync for Codemap
impl Unpin for Codemap
impl UnwindSafe for Codemap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more