pub struct ByColor<T> {
pub black: T,
pub white: T,
}
Expand description
Container with values for each Color
.
Fields§
§black: T
§white: T
Implementations§
source§impl<T> ByColor<T>
impl<T> ByColor<T>
pub fn new_with<F>(init: F) -> ByColor<T>
pub const fn get(&self, color: Color) -> &T
pub fn get_mut(&mut self, color: Color) -> &mut T
pub fn flip(&mut self)
👎Deprecated: Use ByColor::swap()
pub fn swap(&mut self)
pub fn into_flipped(self) -> ByColor<T>
pub fn for_each<F>(self, f: F)where
F: FnMut(T),
pub fn map<U, F>(self, f: F) -> ByColor<U>where
F: FnMut(T) -> U,
pub fn find<F>(&self, predicate: F) -> Option<Color>
pub const fn as_ref(&self) -> ByColor<&T>
pub fn as_mut(&mut self) -> ByColor<&mut T>
pub fn zip<U>(self, other: ByColor<U>) -> ByColor<(T, U)>
pub fn zip_color(self) -> ByColor<(Color, T)>
pub fn iter(&self) -> IntoIter<&T, 2>
pub fn iter_mut(&mut self) -> IntoIter<&mut T, 2>
source§impl<T: PartialOrd> ByColor<T>
impl<T: PartialOrd> ByColor<T>
pub fn normalize(&mut self)
pub fn into_normalized(self) -> ByColor<T>
Trait Implementations§
source§impl Display for ByColor<RemainingChecks>
impl Display for ByColor<RemainingChecks>
source§impl<T> IntoIterator for ByColor<T>
impl<T> IntoIterator for ByColor<T>
source§impl<T: PartialEq> PartialEq for ByColor<T>
impl<T: PartialEq> PartialEq for ByColor<T>
impl<T: Copy> Copy for ByColor<T>
impl<T: Eq> Eq for ByColor<T>
impl<T> StructuralPartialEq for ByColor<T>
Auto Trait Implementations§
impl<T> Freeze for ByColor<T>where
T: Freeze,
impl<T> RefUnwindSafe for ByColor<T>where
T: RefUnwindSafe,
impl<T> Send for ByColor<T>where
T: Send,
impl<T> Sync for ByColor<T>where
T: Sync,
impl<T> Unpin for ByColor<T>where
T: Unpin,
impl<T> UnwindSafe for ByColor<T>where
T: UnwindSafe,
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