Skip to main content

Table

Struct Table 

Source
pub struct Table<X, T, const N: usize> {
    pub all: [T; N],
    /* private fields */
}
Expand description

“Full” table, containing an element of T for every value of X.

Fields§

§all: [T; N]

Implementations§

Source§

impl<T: Copy> Table<Player, T, { _ }>

Source

pub const fn get(&self, key: Player) -> T

Source

pub const fn set(&mut self, key: Player, value: T)

Source§

impl<T> Table<Player, T, { _ }>

Source

pub const fn get_ref(&self, key: Player) -> &T

Source

pub const fn get_mut(&mut self, key: Player) -> &mut T

Source§

impl<T: Copy> Table<Role, T, { _ }>

Source

pub const fn get(&self, key: Role) -> T

Source

pub const fn set(&mut self, key: Role, value: T)

Source§

impl<T> Table<Role, T, { _ }>

Source

pub const fn get_ref(&self, key: Role) -> &T

Source

pub const fn get_mut(&mut self, key: Role) -> &mut T

Source§

impl<X, T, const N: usize> Table<X, T, N>

Source

pub const fn new(all: [T; N]) -> Self

Source§

impl<X, T: Copy, const N: usize> Table<X, T, N>

Source

pub const fn filled(value: T) -> Self

Source§

impl<X, T: Empty, const N: usize> Table<X, T, N>

Source

pub const fn empty() -> Self

Source§

impl<T: Copy> Table<EnPassant, T, { _ }>

Source

pub const fn get(&self, key: EnPassant) -> T

Source

pub const fn set(&mut self, key: EnPassant, value: T)

Source§

impl<T> Table<EnPassant, T, { _ }>

Source

pub const fn get_ref(&self, key: EnPassant) -> &T

Source

pub const fn get_mut(&mut self, key: EnPassant) -> &mut T

Source§

impl<T: Copy> Table<Side, T, { _ }>

Source

pub const fn get(&self, key: Side) -> T

Source

pub const fn set(&mut self, key: Side, value: T)

Source§

impl<T> Table<Side, T, { _ }>

Source

pub const fn get_ref(&self, key: Side) -> &T

Source

pub const fn get_mut(&mut self, key: Side) -> &mut T

Source§

impl<T: Copy> Table<File, T, { _ }>

Source

pub const fn get(&self, key: File) -> T

Source

pub const fn set(&mut self, key: File, value: T)

Source§

impl<T> Table<File, T, { _ }>

Source

pub const fn get_ref(&self, key: File) -> &T

Source

pub const fn get_mut(&mut self, key: File) -> &mut T

Source§

impl<T: Copy> Table<Rank, T, { _ }>

Source

pub const fn get(&self, key: Rank) -> T

Source

pub const fn set(&mut self, key: Rank, value: T)

Source§

impl<T> Table<Rank, T, { _ }>

Source

pub const fn get_ref(&self, key: Rank) -> &T

Source

pub const fn get_mut(&mut self, key: Rank) -> &mut T

Source§

impl<T: Copy> Table<Square, T, { _ }>

Source

pub const fn get(&self, key: Square) -> T

Source

pub const fn set(&mut self, key: Square, value: T)

Source§

impl<T> Table<Square, T, { _ }>

Source

pub const fn get_ref(&self, key: Square) -> &T

Source

pub const fn get_mut(&mut self, key: Square) -> &mut T

Trait Implementations§

Source§

impl<X: Clone, T: Clone, const N: usize> Clone for Table<X, T, N>

Source§

fn clone(&self) -> Table<X, T, N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<X: Copy, T: Copy, const N: usize> Copy for Table<X, T, N>

Source§

impl<X: Debug, T: Debug, const N: usize> Debug for Table<X, T, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<X, T: Default, const N: usize> Default for Table<X, T, N>
where [T; N]: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<X, T: Empty, const N: usize> Empty for Table<X, T, N>

Source§

const EMPTY: Self

Source§

fn is_empty(&self) -> bool

Source§

impl<X, T, const N: usize> From<Table<X, T, N>> for BTreeMap<X, T>
where T: Copy, X: FiniteSet<N> + Ord,

Source§

fn from(table: Table<X, T, N>) -> Self

Converts to this type from the input type.
Source§

impl<T> Index<EnPassant> for Table<EnPassant, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: EnPassant) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<File> for Table<File, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: File) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<Player> for Table<Player, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: Player) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<Rank> for Table<Rank, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: Rank) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<Role> for Table<Role, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: Role) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<Side> for Table<Side, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: Side) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<Square> for Table<Square, T, { _ }>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, key: Square) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<EnPassant> for Table<EnPassant, T, { _ }>

Source§

fn index_mut(&mut self, key: EnPassant) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<File> for Table<File, T, { _ }>

Source§

fn index_mut(&mut self, key: File) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Player> for Table<Player, T, { _ }>

Source§

fn index_mut(&mut self, key: Player) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Rank> for Table<Rank, T, { _ }>

Source§

fn index_mut(&mut self, key: Rank) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Role> for Table<Role, T, { _ }>

Source§

fn index_mut(&mut self, key: Role) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Side> for Table<Side, T, { _ }>

Source§

fn index_mut(&mut self, key: Side) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Square> for Table<Square, T, { _ }>

Source§

fn index_mut(&mut self, key: Square) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<X, T, const N: usize> Serialize for Table<X, T, N>
where T: Copy + Serialize, X: FiniteSet<N> + Ord + Serialize,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<X, T, const N: usize> Freeze for Table<X, T, N>
where T: Freeze,

§

impl<X, T, const N: usize> RefUnwindSafe for Table<X, T, N>

§

impl<X, T, const N: usize> Send for Table<X, T, N>
where T: Send, X: Send,

§

impl<X, T, const N: usize> Sync for Table<X, T, N>
where T: Sync, X: Sync,

§

impl<X, T, const N: usize> Unpin for Table<X, T, N>
where T: Unpin, X: Unpin,

§

impl<X, T, const N: usize> UnsafeUnpin for Table<X, T, N>
where T: UnsafeUnpin,

§

impl<X, T, const N: usize> UnwindSafe for Table<X, T, N>
where T: UnwindSafe, X: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.