pub struct InliningResult { /* private fields */ }
Expand description

The result of a best-effort attempt at inlining.

This struct guarantees that the origin file was readable and valid Rust source code, but errors must be inspected to check if everything was inlined successfully.

Implementations§

source§

impl InliningResult

source

pub fn output(&self) -> &File

The best-effort result of inlining.

source

pub fn errors(&self) -> &[InlineError]

The errors that kept the inlining from completing. May be empty if there were no errors.

source

pub fn has_errors(&self) -> bool

Whether the result has any errors. false implies that all inlining operations completed successfully.

source

pub fn into_output_and_errors(self) -> (File, Vec<InlineError>)

Break an incomplete inlining into the best-effort parsed result and the errors encountered.

Usage
let result = InlinerBuilder::default().parse_and_inline_modules(Path::new("foo.rs"));
match result {
    Err(e) => unimplemented!(),
    Ok(r) if r.has_errors() => {
        let (best_effort, errors) = r.into_output_and_errors();
        // do things with the partial output and the errors
    },
    Ok(r) => {
        let (complete, _) = r.into_output_and_errors();
        // do things with the completed output
    }
}

Trait Implementations§

source§

impl Debug for InliningResult

source§

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

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

impl Display for InliningResult

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.