[][src]Struct pir_8_emu::binutils::pir_8_emu::ExecutionConfig

pub struct ExecutionConfig {
    pub auto_load_next_instruction: bool,
    pub execute_full_instructions: bool,
    pub general_purpose_register_letters: [char; 8],
}

A configuration set, specifying various execution tunings

Fields

auto_load_next_instruction: bool

Automatically load the next instruction, silently performing the NEXT_INSTRUCTION microops

execute_full_instructions: bool

Whether 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]

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]

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]

impl Copy for ExecutionConfig[src]

impl Debug for ExecutionConfig[src]

impl Default for ExecutionConfig[src]

impl<'de> Deserialize<'de> for ExecutionConfig[src]

impl Eq for ExecutionConfig[src]

impl Hash for ExecutionConfig[src]

impl Ord for ExecutionConfig[src]

impl PartialEq<ExecutionConfig> for ExecutionConfig[src]

impl PartialOrd<ExecutionConfig> for ExecutionConfig[src]

impl Serialize for ExecutionConfig[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.