Struct StatementRef

Source
pub struct StatementRef<'a> { /* private fields */ }
Expand description

A reference to a statement which knows its address and can be used to fetch statement information.

Implementations§

Source§

impl StatementRef<'_>

Source

pub fn token_iter<'a, 'b>( &'a self, names: &'a mut NameReader<'b>, ) -> StmtTokenIter<'a, 'b>

Returns a new iterator over tokens of a math expression. names caches the result of any name lookups performed.

Source§

impl<'a> StatementRef<'a>

Source

pub const fn index(self) -> StatementIndex

Fetch the segment-local index of this statement.

Source

pub const fn segment(self) -> SegmentRef<'a>

Back up from a statement reference to a segment reference.

Source

pub const fn statement_type(self) -> StatementType

Gets the type of this statement. May be a pseudo-type.

Source

pub const fn is_assertion(self) -> bool

Returns true if this statement is an Axiom ($a) or Provable ($p) statement.

Source

pub const fn address(self) -> StatementAddress

Obtain a globally-meaningful address for this statement.

Source

pub const fn scope_range(self) -> GlobalRange

Constructs a range from this statement to the end of the database or innermost enclosing scope construct.

This is the end range of a hypothesis or variable defined in this statement.

Source

pub const fn in_group(self) -> bool

True if there is a ${ $} group wrapping this statement.

Source

pub const fn label_span(&self) -> Span

Obtain the span corresponding to the statment label.

Source

pub fn label(&self) -> &'a [u8]

Obtain the statment label.

This will be non-null iff the type requires a label; missing labels for types which use them cause an immediate rewrite to Invalid.

Source

pub fn math_iter(&self) -> TokenIter<'a>

An iterator for the symbols in a statement’s math string.

Source

pub const fn span_full(&self) -> Span

The textual span of this statement within the segment’s buffer.

Does not include trailing white space or surrounding comments; will include leading white space, so a concatenation of spans for all statements will reconstruct the segment source.

Source

pub const fn span(&self) -> Span

The textual span of this statement within the segment’s buffer.

Does not include surrounding white space or comments, unlike span_full().

Source

pub const fn math_len(&self) -> TokenIndex

Count of symbols in this statement’s math string.

Source

pub const fn proof_len(&self) -> TokenIndex

Count of tokens in this statement’s proof string.

Source

pub fn math_span(&self, ix: TokenIndex) -> Span

Given an index into this statement’s math string, find a textual span into the segment buffer.

Source

pub fn proof_span(&self, ix: TokenIndex) -> Span

Given an index into this statement’s proof string, find a textual span into the segment buffer.

Source

pub fn proof_spans(&self) -> &'a [Span]

Get the list of spans of tokens in the proof.

Source

pub fn use_iter(&self) -> UseIter<'a>

Returns an iterator over the statements referenced in the proof.

Source

pub fn math_at(&self, ix: TokenIndex) -> TokenRef<'a>

Given an index into this statement’s math string, get a reference to the math token.

Source

pub fn proof_slice_at(&self, ix: TokenIndex) -> TokenPtr<'a>

Obtains textual proof data by token index.

Source

pub fn associated_comment(&self) -> Option<StatementRef<'a>>

Get the “documentation” comment immediately preceding a $a $p statement, if it exists.

Source

pub const fn comment_contents(&self) -> Span

The contents of a comment statement, excluding the $( and $) delimiters.

Source

pub fn comment_parser(&self) -> CommentParser<'a>

Get an iterator over the markup items in this comment.

Source

pub fn discouragements(&self) -> Discouragements

Parse the associated commment to get the discouragements (Proof modification / new usage discouraged) for this theorem.

Source

pub fn parentheticals(&self) -> ParentheticalIter<'a>

Return an iterator over the parentheticals (like (Contributed by ...)) in this comment statement.

Source

pub fn as_heading_comment(&self) -> Option<HeadingComment>

Returns a HeadingComment object for a heading comment (if it is actually a heading).

Trait Implementations§

Source§

impl<'a> Clone for StatementRef<'a>

Source§

fn clone(&self) -> StatementRef<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for StatementRef<'a>

Source§

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

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

impl<'a> Copy for StatementRef<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for StatementRef<'a>

§

impl<'a> RefUnwindSafe for StatementRef<'a>

§

impl<'a> Send for StatementRef<'a>

§

impl<'a> Sync for StatementRef<'a>

§

impl<'a> Unpin for StatementRef<'a>

§

impl<'a> UnwindSafe for StatementRef<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.