Skip to main content

Preprocessed

Struct Preprocessed 

Source
pub struct Preprocessed {
    pub tokens: Vec<Token>,
    pub expansions: Expansions,
    pub included: Vec<IncludedFile>,
    pub user_headers: Vec<PathBuf>,
    pub embedded_files: Vec<PathBuf>,
    pub link_libraries: Vec<String>,
    pub safe_functions: Vec<SafeName>,
    pub export: bool,
    pub no_std: bool,
    pub crate_path: Option<String>,
    pub pack_events: Vec<(usize, Option<u32>)>,
    pub target_events: Vec<(usize, Vec<(String, SourceRange)>)>,
}
Expand description

Everything one run of the preprocessor produced.

Fields§

§tokens: Vec<Token>

The token list, always ending with TokenKind::Eof.

§expansions: Expansions

The macro invocations that were replaced.

§included: Vec<IncludedFile>

The files #include opened, in the order they were opened, which is also the order they must be added to a source map: a file is always listed after the one whose directive pulled it in.

§user_headers: Vec<PathBuf>

The absolute paths of the user headers that were read, for rebuild tracking. A bundled header cannot change without the crate changing, so it is not listed.

§embedded_files: Vec<PathBuf>

The absolute paths of the resources #embed read, for the same reason and by the same route — except that they are bytes rather than text, so the expansion tracks them with include_bytes!.

§link_libraries: Vec<String>

The libraries #pragma cinrs link asked for, in the order asked.

§safe_functions: Vec<SafeName>

The functions #pragma cinrs safe named, in the order named.

§export: bool

Whether #pragma cinrs export asked for real C symbols.

§no_std: bool

Whether #pragma cinrs no_std said the expansion goes into a #![no_std] crate.

§crate_path: Option<String>

The Rust path #pragma cinrs crate gave the cinrs facade crate, which the generated code names when it needs the runtime.

§pack_events: Vec<(usize, Option<u32>)>

Every #pragma pack the unit wrote, as (token index, alignment).

A pragma is not a token, so the change is recorded against the position in Preprocessed::tokens it takes effect at; PackMap answers what was in force where a struct was defined.

§target_events: Vec<(usize, Vec<(String, SourceRange)>)>

Every #pragma GCC target the unit wrote, as (token index, names).

Recorded the same way Preprocessed::pack_events is, and read the same way: TargetOptionMap answers what was in force where a function was defined.

Trait Implementations§

Source§

impl Debug for Preprocessed

Source§

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

Formats the value using the given formatter. Read more

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> 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, 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.