pub struct LedPattern { /* private fields */ }Expand description
LED colors for all 64 squares in canonical A1-to-H8 order.
Pass a pattern to Command::set_leds
to create the command written to the board.
Implementations§
Source§impl LedPattern
impl LedPattern
Sourcepub const fn new(squares: [LedColor; 64]) -> Self
pub const fn new(squares: [LedColor; 64]) -> Self
Creates a pattern from LedColors in canonical A1-to-H8 order.
Index zero controls A1 and index 63 controls H8.
§Examples
use chessnut_move::protocol::{LedColor, LedPattern, SQUARE_COUNT};
let pattern = LedPattern::new([LedColor::Red; SQUARE_COUNT]);
assert_eq!(pattern, LedPattern::all(LedColor::Red));Sourcepub fn set_color(&mut self, square: Square, color: LedColor)
pub fn set_color(&mut self, square: Square, color: LedColor)
Replaces the selected LedColor for one square.
§Examples
use chessnut_move::protocol::{File, LedColor, LedPattern, Rank, Square};
let square = Square::new(File::D, Rank::Five);
let mut pattern = LedPattern::default();
pattern.set_color(square, LedColor::Red);
assert_eq!(pattern.color_at(square), LedColor::Red);Trait Implementations§
Source§impl Clone for LedPattern
impl Clone for LedPattern
Source§fn clone(&self) -> LedPattern
fn clone(&self) -> LedPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LedPattern
Source§impl Debug for LedPattern
impl Debug for LedPattern
Source§impl Default for LedPattern
impl Default for LedPattern
impl Eq for LedPattern
Source§impl Hash for LedPattern
impl Hash for LedPattern
Source§impl PartialEq for LedPattern
impl PartialEq for LedPattern
impl StructuralPartialEq for LedPattern
Auto Trait Implementations§
impl Freeze for LedPattern
impl RefUnwindSafe for LedPattern
impl Send for LedPattern
impl Sync for LedPattern
impl Unpin for LedPattern
impl UnsafeUnpin for LedPattern
impl UnwindSafe for LedPattern
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