Struct syn_inline_mod::InliningResult
source · 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
impl InliningResult
sourcepub fn errors(&self) -> &[InlineError]
pub fn errors(&self) -> &[InlineError]
The errors that kept the inlining from completing. May be empty if there were no errors.
sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Whether the result has any errors. false
implies that all inlining operations completed
successfully.
sourcepub fn into_output_and_errors(self) -> (File, Vec<InlineError>)
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
impl Debug for InliningResult
Auto Trait Implementations§
impl !RefUnwindSafe for InliningResult
impl !Send for InliningResult
impl !Sync for InliningResult
impl Unpin for InliningResult
impl !UnwindSafe for InliningResult
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