use crate::utils::string::String;
use core::fmt;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct AssemblyOp {
context_name: String,
num_cycles: u8,
op: String,
should_break: bool,
}
impl AssemblyOp {
pub fn new(context_name: String, num_cycles: u8, op: String, should_break: bool) -> Self {
Self {
context_name,
num_cycles,
op,
should_break,
}
}
pub fn context_name(&self) -> &str {
&self.context_name
}
pub const fn num_cycles(&self) -> u8 {
self.num_cycles
}
pub fn op(&self) -> &str {
&self.op
}
pub const fn should_break(&self) -> bool {
self.should_break
}
pub fn set_num_cycles(&mut self, num_cycles: u8) {
self.num_cycles = num_cycles;
}
}
impl fmt::Display for AssemblyOp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"context={}, operation={}, cost={}",
self.context_name, self.op, self.num_cycles,
)
}
}