Struct ruby_prism::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 location range.

Panics

Panics if start offset or end offset are not valid offsets from the root.

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 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<'pr> Drop for ParseResult<'pr>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

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