pub struct Program<F> {
pub instructions_and_debug_infos: Vec<Option<(Instruction<F>, Option<DebugInfo>)>>,
pub pc_base: u32,
}
Fields§
§instructions_and_debug_infos: Vec<Option<(Instruction<F>, Option<DebugInfo>)>>
A map from program counter to instruction.
Sometimes the instructions are enumerated as 0, 4, 8, etc.
Maybe at some point we will replace this with a struct that would have a Vec
under the
hood and divide the incoming pc
by whatever given.
pc_base: u32
Implementations§
Source§impl<F: Field> Program<F>
impl<F: Field> Program<F>
pub fn new_empty(pc_base: u32) -> Self
pub fn new_without_debug_infos( instructions: &[Instruction<F>], pc_base: u32, ) -> Self
pub fn new_without_debug_infos_with_option( instructions: &[Option<Instruction<F>>], pc_base: u32, ) -> Self
Sourcepub fn from_instructions_and_debug_infos(
instructions: &[Instruction<F>],
debug_infos: &[Option<DebugInfo>],
) -> Self
pub fn from_instructions_and_debug_infos( instructions: &[Instruction<F>], debug_infos: &[Option<DebugInfo>], ) -> Self
We assume that pc_start = pc_base = 0 everywhere except the RISC-V programs, until we need otherwise We use DEFAULT_PC_STEP for consistency with RISC-V
pub fn strip_debug_infos(self) -> Self
pub fn from_instructions(instructions: &[Instruction<F>]) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn defined_instructions(&self) -> Vec<Instruction<F>>
pub fn num_defined_instructions(&self) -> usize
pub fn enumerate_by_pc(&self) -> Vec<(u32, Instruction<F>, Option<DebugInfo>)>
pub fn get_instruction_and_debug_info( &self, index: usize, ) -> Option<&(Instruction<F>, Option<DebugInfo>)>
pub fn push_instruction_and_debug_info( &mut self, instruction: Instruction<F>, debug_info: Option<DebugInfo>, )
pub fn push_instruction(&mut self, instruction: Instruction<F>)
pub fn append(&mut self, other: Program<F>)
Source§impl<F> Program<F>
impl<F> Program<F>
pub fn debug_infos(&self) -> ProgramDebugInfo
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for Program<F>where
F: Deserialize<'de>,
impl<'de, F> Deserialize<'de> for Program<F>where
F: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<F> Freeze for Program<F>
impl<F> RefUnwindSafe for Program<F>where
F: RefUnwindSafe,
impl<F> Send for Program<F>where
F: Send,
impl<F> Sync for Program<F>where
F: Sync,
impl<F> Unpin for Program<F>where
F: Unpin,
impl<F> UnwindSafe for Program<F>where
F: UnwindSafe,
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