[−][src]Trait virt_ic::chip::Chip
Chip : a trait that represents chips on board
Required methods
fn get_uuid(&self) -> u128
Give a unique id to maintain continuity when saving. This uuid must not maintain any information other that identity. When saving, this value will be used to link the traced pins to their respective chip.
fn get_type(&self) -> &str
Give a unique name for the chip struct, it must be the same for every chips of the same struct. This value will be used to rebuild the correct Struct based on this name with the help of the chip factory
fn run(&mut self, elapsed_time: Duration)
Runs the chip for a certain amount of time
fn get_pin_qty(&self) -> u8
Returns the number of pins the chip has
fn get_pin(&mut self, pin: u8) -> Result<Rc<RefCell<Pin>>, &str>
Get a pin of the chip
Provided methods
fn get_pin_state(&mut self, pin: u8) -> State
Get the state of the specified Pin
fn set_pin_state(&mut self, pin: u8, state: &State)
Set the state of the specified Pin
fn save(&self) -> SavedChip
Save the chip to a SavedChip struct
fn save_data(&self) -> Vec<String>
Create a Vec of String that must contain every information you need to restore your chip to a certain state. This will be saved in the resulting file.
fn load(&mut self, saved_chip: &SavedChip)
Restore the chip from a SavedChip struct
fn load_data(&mut self, _chip_data: &[String])
Using the array of String you provided in save_data
, you must restore the state of your chip.