ParseResult

Struct ParseResult 

Source
pub struct ParseResult<'pr> { /* private fields */ }
Expand description

The result of parsing a source string.

Implementations§

Source§

impl<'pr> ParseResult<'pr>

Source

pub const fn source(&self) -> &'pr [u8]

Returns the source string that was parsed.

Source

pub fn frozen_string_literals(&self) -> bool

Returns whether we found a frozen_string_literal magic comment with a true value.

Source

pub fn as_slice(&self, location: &Location<'pr>) -> &'pr [u8]

Returns a slice of the source string that was parsed using the given slice range.

Source

pub fn errors(&self) -> Diagnostics<'_>

Returns an iterator that can be used to iterate over the errors in the parse result.

Source

pub fn warnings(&self) -> Diagnostics<'_>

Returns an iterator that can be used to iterate over the warnings in the parse result.

Source

pub fn comments(&self) -> Comments<'_>

Returns an iterator that can be used to iterate over the comments in the parse result.

Source

pub fn magic_comments(&self) -> MagicComments<'_>

Returns an iterator that can be used to iterate over the magic comments in the parse result.

Source

pub fn data_loc(&self) -> Option<Location<'_>>

Returns an optional location of the END marker and the rest of the content of the file.

Source

pub fn node(&self) -> Node<'_>

Returns the root node of the parse result.

Trait Implementations§

Source§

impl<'pr> Debug for ParseResult<'pr>

Source§

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

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

impl Drop for ParseResult<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'pr> Freeze for ParseResult<'pr>

§

impl<'pr> RefUnwindSafe for ParseResult<'pr>

§

impl<'pr> !Send for ParseResult<'pr>

§

impl<'pr> !Sync for ParseResult<'pr>

§

impl<'pr> Unpin for ParseResult<'pr>

§

impl<'pr> UnwindSafe for ParseResult<'pr>

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