pub struct TransactionFlag { /* private fields */ }Expand description
Typed wrapper for the transaction-header flag token.
May be STAR (*), PENDING_KW (!), FLAG (letter),
HASH (#), TXN_KW (txn), or single-character CURRENCY
(ticker-letter flag, e.g. T). Use Self::classify for
exhaustive match ergonomics, or the is_* predicates for
boolean checks.
Note: Self::cast is position-AGNOSTIC — it accepts any
token of a flag-eligible kind regardless of where it sits in
the tree. To get the leading flag of a transaction, use
Transaction::flag (which scopes the search to the
pre-content header region).
Implementations§
Source§impl TransactionFlag
impl TransactionFlag
Sourcepub fn cast(token: SyntaxToken) -> Option<Self>
pub fn cast(token: SyntaxToken) -> Option<Self>
Wrap the token if its kind is a valid transaction flag.
For CURRENCY, only single-character forms qualify.
Single source of truth: this match also derives
Self::classify’s result, so cast + classify cannot
drift.
pub const fn syntax(&self) -> &SyntaxToken
pub fn kind(&self) -> SyntaxKind
pub fn text(&self) -> &str
Sourcepub const fn classify(&self) -> TransactionFlagKind
pub const fn classify(&self) -> TransactionFlagKind
Exhaustive classification — pair with a match for
compiler-checked coverage of every variant. Cached at
cast() time; no runtime panic risk.
pub const fn is_star(&self) -> bool
pub const fn is_pending(&self) -> bool
pub const fn is_hash(&self) -> bool
pub const fn is_txn(&self) -> bool
pub const fn is_letter_flag(&self) -> bool
pub const fn is_currency_letter(&self) -> bool
Trait Implementations§
Source§impl Clone for TransactionFlag
impl Clone for TransactionFlag
Source§fn clone(&self) -> TransactionFlag
fn clone(&self) -> TransactionFlag
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionFlag
impl Debug for TransactionFlag
impl Eq for TransactionFlag
Source§impl Hash for TransactionFlag
impl Hash for TransactionFlag
Source§impl PartialEq for TransactionFlag
impl PartialEq for TransactionFlag
Source§fn eq(&self, other: &TransactionFlag) -> bool
fn eq(&self, other: &TransactionFlag) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TransactionFlag
Auto Trait Implementations§
impl !RefUnwindSafe for TransactionFlag
impl !Send for TransactionFlag
impl !Sync for TransactionFlag
impl !UnwindSafe for TransactionFlag
impl Freeze for TransactionFlag
impl Unpin for TransactionFlag
impl UnsafeUnpin for TransactionFlag
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.