Skip to main content

CookedFile

Struct CookedFile 

Source
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: usize

Errors 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

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CookedFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CookedFile

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<IndexedRendering> for CookedFile

Source§

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.