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<'_>
impl StatementRef<'_>
Sourcepub fn token_iter<'a, 'b>(
&'a self,
names: &'a mut NameReader<'b>,
) -> StmtTokenIter<'a, 'b> ⓘ
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>
impl<'a> StatementRef<'a>
Sourcepub const fn index(self) -> StatementIndex
pub const fn index(self) -> StatementIndex
Fetch the segment-local index of this statement.
Sourcepub const fn segment(self) -> SegmentRef<'a>
pub const fn segment(self) -> SegmentRef<'a>
Back up from a statement reference to a segment reference.
Sourcepub const fn statement_type(self) -> StatementType
pub const fn statement_type(self) -> StatementType
Gets the type of this statement. May be a pseudo-type.
Sourcepub const fn is_assertion(self) -> bool
pub const fn is_assertion(self) -> bool
Returns true if this statement is an Axiom
($a
) or Provable
($p
) statement.
Sourcepub const fn address(self) -> StatementAddress
pub const fn address(self) -> StatementAddress
Obtain a globally-meaningful address for this statement.
Sourcepub const fn scope_range(self) -> GlobalRange
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.
Sourcepub const fn label_span(&self) -> Span
pub const fn label_span(&self) -> Span
Obtain the span corresponding to the statment label.
Sourcepub fn label(&self) -> &'a [u8] ⓘ
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
.
Sourcepub fn math_iter(&self) -> TokenIter<'a> ⓘ
pub fn math_iter(&self) -> TokenIter<'a> ⓘ
An iterator for the symbols in a statement’s math string.
Sourcepub const fn span_full(&self) -> Span
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.
Sourcepub const fn span(&self) -> Span
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()
.
Sourcepub const fn math_len(&self) -> TokenIndex
pub const fn math_len(&self) -> TokenIndex
Count of symbols in this statement’s math string.
Sourcepub const fn proof_len(&self) -> TokenIndex
pub const fn proof_len(&self) -> TokenIndex
Count of tokens in this statement’s proof string.
Sourcepub fn math_span(&self, ix: TokenIndex) -> Span
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.
Sourcepub fn proof_span(&self, ix: TokenIndex) -> Span
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.
Sourcepub fn proof_spans(&self) -> &'a [Span]
pub fn proof_spans(&self) -> &'a [Span]
Get the list of spans of tokens in the proof.
Sourcepub fn use_iter(&self) -> UseIter<'a> ⓘ
pub fn use_iter(&self) -> UseIter<'a> ⓘ
Returns an iterator over the statements referenced in the proof.
Sourcepub fn math_at(&self, ix: TokenIndex) -> TokenRef<'a>
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.
Sourcepub fn proof_slice_at(&self, ix: TokenIndex) -> TokenPtr<'a>
pub fn proof_slice_at(&self, ix: TokenIndex) -> TokenPtr<'a>
Obtains textual proof data by token index.
Sourcepub fn associated_comment(&self) -> Option<StatementRef<'a>>
pub fn associated_comment(&self) -> Option<StatementRef<'a>>
Get the “documentation” comment immediately preceding a $a $p statement, if it exists.
Sourcepub const fn comment_contents(&self) -> Span
pub const fn comment_contents(&self) -> Span
The contents of a comment statement, excluding the $(
and $)
delimiters.
Sourcepub fn comment_parser(&self) -> CommentParser<'a> ⓘ
pub fn comment_parser(&self) -> CommentParser<'a> ⓘ
Get an iterator over the markup items in this comment.
Sourcepub fn discouragements(&self) -> Discouragements
pub fn discouragements(&self) -> Discouragements
Parse the associated commment to get the discouragements (Proof modification / new usage discouraged) for this theorem.
Sourcepub fn parentheticals(&self) -> ParentheticalIter<'a> ⓘ
pub fn parentheticals(&self) -> ParentheticalIter<'a> ⓘ
Return an iterator over the parentheticals (like (Contributed by ...)
)
in this comment statement.
Sourcepub fn as_heading_comment(&self) -> Option<HeadingComment>
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>
impl<'a> Clone for StatementRef<'a>
Source§fn clone(&self) -> StatementRef<'a>
fn clone(&self) -> StatementRef<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a> Debug for StatementRef<'a>
impl<'a> Debug for StatementRef<'a>
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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