pub struct Rotor { /* private fields */ }
Expand description
The Engima Rotor or Walzen
Implementations§
Source§impl Rotor
impl Rotor
Sourcepub const fn from_static_str(
string: &'static str,
notches: [Letter; 2],
fixed: bool,
) -> Rotor
pub const fn from_static_str( string: &'static str, notches: [Letter; 2], fixed: bool, ) -> Rotor
Create a Rotor
from a string
If the Rotor
has a single notch then the notches
array should be set to that value for all elements
Sourcepub fn set_grundstellung(&mut self, letter: Letter)
pub fn set_grundstellung(&mut self, letter: Letter)
Set the rotors initial positions
Sourcepub fn set_ringstellung(&mut self, ringstellung: u8)
pub fn set_ringstellung(&mut self, ringstellung: u8)
Sourcepub fn wiring_map(&self, index: Letter) -> Letter
pub fn wiring_map(&self, index: Letter) -> Letter
Send a signal to the right side of the rotor at position index
and return the position the signal exits the rotor
Sourcepub fn rev_wiring_map(&self, index: Letter) -> Letter
pub fn rev_wiring_map(&self, index: Letter) -> Letter
Send a signal to the left side of the rotor at position index
and return the position the signal exits the rotor
Sourcepub fn get_grundstellung(&self) -> Letter
pub fn get_grundstellung(&self) -> Letter
Get current position
Trait Implementations§
Source§impl Ord for Rotor
impl Ord for Rotor
Source§impl PartialOrd for Rotor
impl PartialOrd for Rotor
impl Copy for Rotor
impl Eq for Rotor
impl StructuralPartialEq for Rotor
Auto Trait Implementations§
impl Freeze for Rotor
impl RefUnwindSafe for Rotor
impl Send for Rotor
impl Sync for Rotor
impl Unpin for Rotor
impl UnwindSafe for Rotor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more