pub struct CookedFile {
pub declarations: Vec<DeclFact>,
pub macros: Vec<MacroFact>,
pub diagnostics: Vec<CookedDiagnostic>,
pub unplaced: usize,
}Fields§
§declarations: Vec<DeclFact>The declarations the rendering read as, every range mapped back into the file.
macros: Vec<MacroFact>The macros the rendering was read with — and this is the half that answers a question the file’s own reading cannot.
A rendering has no directives left in it: the preprocessor already chose which branches are compiled, so
every #define the rendering contains is one that is in force, and every fact here carries
FactGuard::Unconditional. The file’s own reading keeps all of them, each tagged with the region it was
written in, and every consumer then has to decide those regions again — which is a second implementation
of the preprocessor’s own decision, and it is the one that keeps being wrong.
Measured on vcruntime.h, which writes _STL_LANG once per branch of #ifdef __cplusplus: the raw reading
files all three, the last of them 0L, and a lookup that takes “the last binding at or before this offset”
answers 0L for a file the compiler read as C++20. The rendering holds the taken one and nothing else, so a
consumer that reads these has no region to judge.
diagnostics: Vec<CookedDiagnostic>The rendering’s parse errors, placed in the file — see crate::CookedDiagnostic.
unplaced: usizeErrors the parse of the rendering reported that this file cannot show, because the text they are about is not written here.
Kept with the reading rather than with the caller, because it is what makes “no errors” honest: an empty
CookedFile::diagnostics beside a non-zero count here means the rendering was not clean and the reader
simply cannot be shown where.
Implementations§
Source§impl CookedFile
impl CookedFile
Sourcepub fn declarations(declarations: Vec<DeclFact>) -> Self
pub fn declarations(declarations: Vec<DeclFact>) -> Self
A reading that found declarations and nothing to report.
For a caller with facts and no parse of its own — a test that built a rendering by hand, or a future producer that reads the declarations back from a cache.
Trait Implementations§
Source§impl Clone for CookedFile
impl Clone for CookedFile
Source§impl Debug for CookedFile
impl Debug for CookedFile
Source§impl Default for CookedFile
impl Default for CookedFile
Source§impl From<IndexedRendering> for CookedFile
impl From<IndexedRendering> for CookedFile
Source§fn from(indexed: IndexedRendering) -> Self
fn from(indexed: IndexedRendering) -> Self
What the index keeps of a rendering’s reading: the declarations, the macros it was read with, the errors this file can show, and the count of the ones it cannot.
The summary itself is still not kept, and the reason stands: a rendering’s directives and includes are
empty, because that text was spelled out by this crate rather than by the file, and keeping them would invite
a reader to believe them. Macros are the exception and the point — a rendering’s macros are the ones the
preprocessor chose, with no region left to judge (see CookedFile::macros).
Auto Trait Implementations§
impl Forget for CookedFile
impl Freeze for CookedFile
impl Move for CookedFile
impl RefUnwindSafe for CookedFile
impl Send for CookedFile
impl Sync for CookedFile
impl Unpin for CookedFile
impl UnsafeUnpin for CookedFile
impl UnwindSafe for CookedFile
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
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> ⓘ
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> ⓘ
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