pub struct Wheel<const ROTOR_NUM: usize = DEFAULT_ROTOR_NUM> { /* private fields */ }
Expand description
Represents the configuration (i.e. ordering) of the Rotor
set in an Enigma machine
Implementations§
Source§impl<const ROTOR_NUM: usize> Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Wheel<ROTOR_NUM>
Sourcepub fn new(rotors: [Rotor; ROTOR_NUM]) -> Self
pub fn new(rotors: [Rotor; ROTOR_NUM]) -> Self
Creates a new Rotor
configuration in left-to-right ordering
Sourcepub fn set_positions(&mut self, positions: [Letter; ROTOR_NUM])
pub fn set_positions(&mut self, positions: [Letter; ROTOR_NUM])
Set the positions of each Rotor
in left-to-right ordering
Sourcepub fn set_ring_wiring_offset(&mut self, positions: [u8; ROTOR_NUM])
pub fn set_ring_wiring_offset(&mut self, positions: [u8; ROTOR_NUM])
Set the wiring offset (aka ring setting) of each Rotor
in left-to-right ordering
Sourcepub fn get_positions(&self) -> [Letter; ROTOR_NUM]
pub fn get_positions(&self) -> [Letter; ROTOR_NUM]
Get current Rotor
positions
Trait Implementations§
Source§impl<const ROTOR_NUM: usize> Ord for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Ord for Wheel<ROTOR_NUM>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<const ROTOR_NUM: usize> PartialOrd for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> PartialOrd for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Copy for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Eq for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> StructuralPartialEq for Wheel<ROTOR_NUM>
Auto Trait Implementations§
impl<const ROTOR_NUM: usize> Freeze for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> RefUnwindSafe for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Send for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Sync for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> Unpin for Wheel<ROTOR_NUM>
impl<const ROTOR_NUM: usize> UnwindSafe for Wheel<ROTOR_NUM>
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