[−][src]Struct pir_8_emu::binutils::pir_8_emu::ExecutionConfig
A configuration set, specifying various execution tunings
Fields
auto_load_next_instruction: boolAutomatically load the next instruction, silently performing the
NEXT_INSTRUCTION microops
execute_full_instructions: boolWhether to perform all of instructions' μOps at once
general_purpose_register_letters: [char; 8]The register letters
Validated and optionally truncated/reset at load
Methods
impl ExecutionConfig[src]
pub fn new() -> ExecutionConfig[src]
Create a new default-initialised config
pub fn read_from_config_dir<P: Into<PathBuf>>(
cfg_dir: P
) -> Result<Option<ExecutionConfig>, Result<IoError, TomlError>>[src]
cfg_dir: P
) -> Result<Option<ExecutionConfig>, Result<IoError, TomlError>>
Read an execution config from file named "exec_cfg.toml" under the specified config directory
Returns Err(Ok(ioe)) if reading the file failed with ioe.
Returns Err(Err(te)) if parsing the read file failed with te.
Returns Ok(None) if the file didn't exist.
Returns Ok(Some(ec)), if the file was correctly read and parsed as TOML,
the contents of ec start off as ExecutionConfig::new(), and are then updated with each valid key,
this behaviour is consistent with the Deserialize implementation.
Examples
Given "$ROOT/exec_cfg.toml" containing:
execute_full_instructions = true
hewwo = "uWu"
general_purpose_register_letters = ['H', 'e', 'w', 'w', 'o', 'U', 'w', 'U']
The following holds:
let root = Path::new("$ROOT"); assert_eq!(ExecutionConfig::read_from_config_dir(root).unwrap(), Some(ExecutionConfig { execute_full_instructions: true, general_purpose_register_letters: ['H', 'e', 'w', 'w', 'o', 'U', 'w', 'U'], ..ExecutionConfig::new() }));
pub fn write_to_config_dir<P: Into<PathBuf>>(
&self,
cfg_dir: P
) -> Result<(), IoError>[src]
&self,
cfg_dir: P
) -> Result<(), IoError>
Write this execution config to the file named "exec_cfg.toml" under the specified config directory
The specified config directory and all its ascendants will be created
Examples
let root = Path::new("$ROOT"); ExecutionConfig::new().write_to_config_dir(&root).unwrap(); assert_eq!(fs::read_to_string(root.join("exec_cfg.toml")).unwrap(), "auto_load_next_instruction = false\n\ execute_full_instructions = false\n\ general_purpose_register_letters = [\n\ \x20 'F',\n\ \x20 'S',\n\ \x20 'X',\n\ \x20 'Y',\n\ \x20 'A',\n\ \x20 'B',\n\ \x20 'C',\n\ \x20 'D',\n\ ]\n");
Trait Implementations
impl Clone for ExecutionConfig[src]
fn clone(&self) -> ExecutionConfig[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for ExecutionConfig[src]
impl Debug for ExecutionConfig[src]
impl Default for ExecutionConfig[src]
fn default() -> ExecutionConfig[src]
impl<'de> Deserialize<'de> for ExecutionConfig[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>[src]
impl Eq for ExecutionConfig[src]
impl Hash for ExecutionConfig[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for ExecutionConfig[src]
fn cmp(&self, other: &ExecutionConfig) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> Self1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<ExecutionConfig> for ExecutionConfig[src]
fn eq(&self, other: &ExecutionConfig) -> bool[src]
fn ne(&self, other: &ExecutionConfig) -> bool[src]
impl PartialOrd<ExecutionConfig> for ExecutionConfig[src]
fn partial_cmp(&self, other: &ExecutionConfig) -> Option<Ordering>[src]
fn lt(&self, other: &ExecutionConfig) -> bool[src]
fn le(&self, other: &ExecutionConfig) -> bool[src]
fn gt(&self, other: &ExecutionConfig) -> bool[src]
fn ge(&self, other: &ExecutionConfig) -> bool[src]
impl Serialize for ExecutionConfig[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralEq for ExecutionConfig[src]
impl StructuralPartialEq for ExecutionConfig[src]
Auto Trait Implementations
impl RefUnwindSafe for ExecutionConfig
impl Send for ExecutionConfig
impl Sync for ExecutionConfig
impl Unpin for ExecutionConfig
impl UnwindSafe for ExecutionConfig
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> Downcast for T where
T: Any, [src]
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>[src]
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>[src]
fn as_any(&self) -> &(dyn Any + 'static)[src]
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any, [src]
T: Send + Sync + Any,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,