Struct miden_objects::notes::NoteScript
source · pub struct NoteScript { /* private fields */ }Expand description
An executable program of a note.
A note’s script represents a program which must be executed for a note to be consumed. As such it defines the rules and side effects of consuming a given note.
Implementations§
source§impl NoteScript
impl NoteScript
sourcepub fn new(
code: ProgramAst,
assembler: &Assembler
) -> Result<(Self, CodeBlock), NoteError>
pub fn new( code: ProgramAst, assembler: &Assembler ) -> Result<(Self, CodeBlock), NoteError>
Returns a new NoteScript instantiated from the provided program and compiled with the provided assembler. The compiled code block is also returned.
§Errors
Returns an error if the compilation of the provided program fails.
sourcepub fn from_parts(code: ProgramAst, hash: Digest) -> Self
pub fn from_parts(code: ProgramAst, hash: Digest) -> Self
Returns a new NoteScript instantiated from the provided components.
Note: this function assumes that the specified hash results from the compilation of the provided program, but this is not checked.
sourcepub fn code(&self) -> &ProgramAst
pub fn code(&self) -> &ProgramAst
Returns the AST of this note script.
Trait Implementations§
source§impl Clone for NoteScript
impl Clone for NoteScript
source§fn clone(&self) -> NoteScript
fn clone(&self) -> NoteScript
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for NoteScript
impl Debug for NoteScript
source§impl Deserializable for NoteScript
impl Deserializable for NoteScript
source§fn read_from<R: ByteReader>(
source: &mut R
) -> Result<Self, DeserializationError>
fn read_from<R: ByteReader>( source: &mut R ) -> Result<Self, DeserializationError>
Reads a sequence of bytes from the provided
source, attempts to deserialize these bytes
into Self, and returns the result. Read moresource§fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
fn read_from_bytes(bytes: &[u8]) -> Result<Self, DeserializationError>
source§impl PartialEq for NoteScript
impl PartialEq for NoteScript
source§fn eq(&self, other: &NoteScript) -> bool
fn eq(&self, other: &NoteScript) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serializable for NoteScript
impl Serializable for NoteScript
source§fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes
self into bytes and writes these bytes into the target.source§fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self. Read more
impl Eq for NoteScript
impl StructuralPartialEq for NoteScript
Auto Trait Implementations§
impl RefUnwindSafe for NoteScript
impl Send for NoteScript
impl Sync for NoteScript
impl Unpin for NoteScript
impl UnwindSafe for NoteScript
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