pub struct ContextCharged<For = ForNothing> { /* private fields */ }Expand description
Context charged gas for the program execution.
Implementations§
Source§impl ContextCharged
impl ContextCharged
Sourcepub fn new(
destination_id: ActorId,
dispatch: IncomingDispatch,
gas_allowance: u64,
) -> ContextCharged<ForNothing>
pub fn new( destination_id: ActorId, dispatch: IncomingDispatch, gas_allowance: u64, ) -> ContextCharged<ForNothing>
Creates a new empty instance of the context charged for the program execution.
Source§impl<T> ContextCharged<T>
impl<T> ContextCharged<T>
Sourcepub fn into_parts(
self,
) -> (ActorId, IncomingDispatch, GasCounter, GasAllowanceCounter)
pub fn into_parts( self, ) -> (ActorId, IncomingDispatch, GasCounter, GasAllowanceCounter)
Splits the context into parts.
Sourcepub fn gas_burned(&self) -> u64
pub fn gas_burned(&self) -> u64
Gas already burned
Source§impl ContextCharged<ForNothing>
impl ContextCharged<ForNothing>
Sourcepub fn charge_for_program(
self,
block_config: &BlockConfig,
) -> PrechargeResult<ContextCharged<ForProgram>>
pub fn charge_for_program( self, block_config: &BlockConfig, ) -> PrechargeResult<ContextCharged<ForProgram>>
Charges gas for getting the program data.
Source§impl ContextCharged<ForProgram>
impl ContextCharged<ForProgram>
Sourcepub fn charge_for_code_metadata(
self,
block_config: &BlockConfig,
) -> PrechargeResult<ContextCharged<ForCodeMetadata>>
pub fn charge_for_code_metadata( self, block_config: &BlockConfig, ) -> PrechargeResult<ContextCharged<ForCodeMetadata>>
Charges gas for getting the code metadata.
Source§impl ContextCharged<ForCodeMetadata>
impl ContextCharged<ForCodeMetadata>
Sourcepub fn charge_for_original_code(
self,
block_config: &BlockConfig,
code_len_bytes: u32,
) -> PrechargeResult<ContextCharged<ForOriginalCode>>
pub fn charge_for_original_code( self, block_config: &BlockConfig, code_len_bytes: u32, ) -> PrechargeResult<ContextCharged<ForOriginalCode>>
Charges gas for getting the original code.
Sourcepub fn charge_for_instrumented_code(
self,
block_config: &BlockConfig,
code_len_bytes: u32,
) -> PrechargeResult<ContextCharged<ForInstrumentedCode>>
pub fn charge_for_instrumented_code( self, block_config: &BlockConfig, code_len_bytes: u32, ) -> PrechargeResult<ContextCharged<ForInstrumentedCode>>
Charges gas for getting the instrumented code.
Source§impl ContextCharged<ForOriginalCode>
impl ContextCharged<ForOriginalCode>
Sourcepub fn charge_for_instrumentation(
self,
block_config: &BlockConfig,
original_code_len_bytes: u32,
) -> PrechargeResult<ContextCharged<ForInstrumentedCode>>
pub fn charge_for_instrumentation( self, block_config: &BlockConfig, original_code_len_bytes: u32, ) -> PrechargeResult<ContextCharged<ForInstrumentedCode>>
Charges gas for code instrumentation.
Source§impl ContextCharged<ForInstrumentedCode>
impl ContextCharged<ForInstrumentedCode>
Sourcepub fn charge_for_allocations(
self,
block_config: &BlockConfig,
allocations_tree_len: u32,
) -> PrechargeResult<ContextCharged<ForAllocations>>
pub fn charge_for_allocations( self, block_config: &BlockConfig, allocations_tree_len: u32, ) -> PrechargeResult<ContextCharged<ForAllocations>>
Charges gas for allocations.
Source§impl ContextCharged<ForAllocations>
impl ContextCharged<ForAllocations>
Sourcepub fn charge_for_module_instantiation(
self,
block_config: &BlockConfig,
actor_data: ExecutableActorData,
section_sizes: &InstantiatedSectionSizes,
code_metadata: &CodeMetadata,
) -> PrechargeResult<ContextCharged<ForModuleInstantiation>>
pub fn charge_for_module_instantiation( self, block_config: &BlockConfig, actor_data: ExecutableActorData, section_sizes: &InstantiatedSectionSizes, code_metadata: &CodeMetadata, ) -> PrechargeResult<ContextCharged<ForModuleInstantiation>>
Charges gas for module instantiation.
Source§impl ContextCharged<ForModuleInstantiation>
impl ContextCharged<ForModuleInstantiation>
Sourcepub fn into_final_parts(
self,
) -> (ActorId, IncomingDispatch, GasCounter, GasAllowanceCounter, ExecutableActorData, ReservationsAndMemorySize)
pub fn into_final_parts( self, ) -> (ActorId, IncomingDispatch, GasCounter, GasAllowanceCounter, ExecutableActorData, ReservationsAndMemorySize)
Converts the context into the final parts.
Auto Trait Implementations§
impl<For> Freeze for ContextCharged<For>
impl<For> RefUnwindSafe for ContextCharged<For>where
For: RefUnwindSafe,
impl<For> Send for ContextCharged<For>where
For: Send,
impl<For> Sync for ContextCharged<For>where
For: Sync,
impl<For> Unpin for ContextCharged<For>where
For: Unpin,
impl<For> UnwindSafe for ContextCharged<For>where
For: UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> 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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
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>
Returns the layout of the type.
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
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to
unchecked_from.Source§impl<T> Upcastable for T
impl<T> Upcastable for T
Source§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
Source§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref