Enum advent_solutions::advent2017::day18::Instruction
[−]
[src]
pub enum Instruction {
Snd(Value),
Set(char, Value),
Add(char, Value),
Mul(char, Value),
Mod(char, Value),
Rcv(char),
Jgz(Value, Value),
}There aren't that many instructions, so it shouldn't be hard to figure out what they do. Here's what you determine:
-
snd Xplays a sound with a frequency equal to the value ofX. -
set X Ysets registerXto the value ofY. -
add X Yincreases registerXby the value ofY. -
mul X Ysets registerXto the result of multiplying the value contained in registerXby the value ofY. -
mod X Ysets registerXto the remainder of dividing the value contained in registerXby the value ofY(that is, it setsXto the result ofXmoduloY). -
rcv Xrecovers the frequency of the last sound played, but only when the value ofXis not zero. (If it is zero, the command does nothing.) -
jgz X Yjumps with an offset of the value ofY, but only if the value ofXis greater than zero. (An offset of2skips the next instruction, an offset of-1jumps to the previous instruction, and so on.)
Variants
Snd(Value)Set(char, Value)Add(char, Value)Mul(char, Value)Mod(char, Value)Rcv(char)Jgz(Value, Value)
Methods
impl Instruction[src]
pub fn from_bytes(i: &[u8]) -> IResult<&[u8], Instruction, u32>
pub fn list_from_bytes(i: &[u8]) -> IResult<&[u8], Vec<Instruction>, u32>
Trait Implementations
impl Copy for Instruction[src]
impl Clone for Instruction[src]
fn clone(&self) -> Instruction[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for Instruction[src]
fn eq(&self, __arg_0: &Instruction) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Instruction) -> bool[src]
This method tests for !=.
impl Eq for Instruction[src]
impl Debug for Instruction[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more