pub struct Callstack { /* private fields */ }Expand description
A struct representing a callstack.
Implementations§
Source§impl Callstack
impl Callstack
Sourcepub fn first(&self) -> CallstackElement
pub fn first(&self) -> CallstackElement
Returns the first (bottom most) callstack element.
Sourcepub fn pop(&mut self) -> Option<CallstackElement>
pub fn pop(&mut self) -> Option<CallstackElement>
Returns the current callstack element and removes it from the callstack.
Sourcepub fn push(&mut self, element: CallstackElement)
pub fn push(&mut self, element: CallstackElement)
Pushes a new callstack element onto the callstack.
Sourcepub fn attached_value(&self) -> U512
pub fn attached_value(&self) -> U512
Returns the attached value.
If the current element is a contract call, the attached value is the amount of tokens attached to the contract call. If the current element is an account, the attached value is zero.
Sourcepub fn attach_value(&mut self, amount: U512)
pub fn attach_value(&mut self, amount: U512)
Attaches the given amount of tokens to the current contract call.
If the current element is not a contract call, this method does nothing.
Sourcepub fn current(&self) -> &CallstackElement
pub fn current(&self) -> &CallstackElement
Returns the current callstack element.
Sourcepub fn previous(&self) -> &CallstackElement
pub fn previous(&self) -> &CallstackElement
Returns the previous (second) callstack element.
Sourcepub fn record(&mut self)
pub fn record(&mut self)
Stringifies the callstack elements and stores them in the stack record.
Sourcepub fn record_to_string(&self) -> String
pub fn record_to_string(&self) -> String
Returns the stack record as a string.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Callstack
impl RefUnwindSafe for Callstack
impl Send for Callstack
impl Sync for Callstack
impl Unpin for Callstack
impl UnwindSafe for Callstack
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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