pub enum SeedsExpr {
List(Punctuated<Expr, Comma>),
Expr(Box<Expr>),
}Expand description
Seeds can be written as a literal slice ([ a, b ]) or any
expression that produces &[&[u8]] at run time.
Variants§
List(Punctuated<Expr, Comma>)
Example: [ b"prefix".as_ref(), key.as_ref() ]
Expr(Box<Expr>)
Example: pda_seeds(key)
Implementations§
Source§impl SeedsExpr
impl SeedsExpr
Sourcepub fn pop(&mut self) -> Option<Pair<Expr, Comma>>
pub fn pop(&mut self) -> Option<Pair<Expr, Comma>>
Mirrors Punctuated::pop: removes and returns the last element and its
trailing punctuation when this is the List variant. For the Expr variant,
which represents a single non-list seed expression, returns None because
there is no list to pop from.
pub fn push_value(&mut self, value: Expr)
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Mirrors Punctuated::push_value: pushes a value without punctuation onto
the underlying list when this is the List variant. No-op for the Expr
variant.
Trait Implementations§
Source§impl ToTokens for SeedsExpr
Allow quote!{ #seeds }
impl ToTokens for SeedsExpr
Allow quote!{ #seeds }
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for SeedsExpr
impl RefUnwindSafe for SeedsExpr
impl !Send for SeedsExpr
impl !Sync for SeedsExpr
impl Unpin for SeedsExpr
impl UnsafeUnpin for SeedsExpr
impl UnwindSafe for SeedsExpr
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.