pub struct CostEstimate { /* private fields */ }
testutils
only.Implementations§
Source§impl CostEstimate
impl CostEstimate
Sourcepub fn resources(&self) -> InvocationResources
pub fn resources(&self) -> InvocationResources
Returns the resources metered during the last top level contract
invocation.
Take the return value with a grain of salt. The returned resources mostly
correspond only to the operations that have happened during the host
invocation, i.e. this won’t try to simulate the work that happens in
production scenarios (e.g. certain XDR rountrips). This also doesn’t try
to model resources related to the transaction size.
The returned value is as useful as the preceding setup, e.g. if a test contract is used instead of a Wasm contract, all the costs related to VM instantiation and execution, as well as Wasm reads/rent bumps will be missed.
Sourcepub fn fee(&self) -> FeeEstimate
pub fn fee(&self) -> FeeEstimate
Estimates the fee for the last invocation’s resources, i.e. the
resources returned by resources()
.
The fees are computed using the snapshot of the Stellar Pubnet fees made on 2024-12-11.
Take the return value with a grain of salt as both the resource estimate and the fee rates may be imprecise.
The returned value is as useful as the preceding setup, e.g. if a test contract is used instead of a Wasm contract, all the costs related to VM instantiation and execution, as well as Wasm reads/rent bumps will be missed.
Sourcepub fn budget(&self) -> Budget
pub fn budget(&self) -> Budget
Returns the budget object that provides the detailed CPU and memory metering information recorded thus far.
The budget metering resets before every top-level contract level invocation.
budget() may also be used to adjust the CPU and memory limits via the
reset_
methods.
Note, that unlike resources()
/fee()
this will always return some
value. If there was no contract call, then the resulting value will
correspond to metering any environment setup that has been made thus
far.
Auto Trait Implementations§
impl Freeze for CostEstimate
impl !RefUnwindSafe for CostEstimate
impl !Send for CostEstimate
impl !Sync for CostEstimate
impl Unpin for CostEstimate
impl !UnwindSafe for CostEstimate
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, U, V, W, E, C> Compare<(T, U, V, W)> for C
impl<T, U, V, W, E, C> Compare<(T, U, V, W)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W), b: &(T, U, V, W), ) -> Result<Ordering, <C as Compare<(T, U, V, W)>>::Error>
Source§impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
impl<T, U, V, W, X, E, C> Compare<(T, U, V, W, X)> for C
type Error = E
fn compare( &self, a: &(T, U, V, W, X), b: &(T, U, V, W, X), ) -> Result<Ordering, <C as Compare<(T, U, V, W, X)>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.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