pub struct Program { /* private fields */ }
Expand description
Program.
Implementations§
source§impl Program
impl Program
sourcepub fn new(id: ProgramId, code: InstrumentedCode) -> Self
pub fn new(id: ProgramId, code: InstrumentedCode) -> Self
New program with specific id
and code
.
sourcepub fn from_parts(
id: ProgramId,
code: InstrumentedCode,
allocations: BTreeSet<WasmPage>,
is_initialized: bool
) -> Self
pub fn from_parts( id: ProgramId, code: InstrumentedCode, allocations: BTreeSet<WasmPage>, is_initialized: bool ) -> Self
New program from stored data
sourcepub fn code(&self) -> &InstrumentedCode
pub fn code(&self) -> &InstrumentedCode
Reference to InstrumentedCode
of this program.
sourcepub fn static_pages(&self) -> WasmPage
pub fn static_pages(&self) -> WasmPage
Get initial memory size for this program.
sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Get whether program is initialized
By default the Program
is not initialized. The initialized status
is set from the node.
sourcepub fn set_initialized(&mut self)
pub fn set_initialized(&mut self)
Set program initialized
sourcepub fn allocations(&self) -> &BTreeSet<WasmPage>
pub fn allocations(&self) -> &BTreeSet<WasmPage>
Get allocations as a set of page numbers.
sourcepub fn set_allocations(&mut self, allocations: BTreeSet<WasmPage>)
pub fn set_allocations(&mut self, allocations: BTreeSet<WasmPage>)
Set allocations as a set of page numbers.
Trait Implementations§
source§impl Decode for Program
impl Decode for Program
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl Encode for Program
impl Encode for Program
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
impl EncodeLike<Program> for Program
Auto Trait Implementations§
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
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