Struct Square

Source
pub struct Square(/* private fields */);
Expand description

Represent a square on the chess board

Implementations§

Source§

impl Square

Source

pub const A1: Square

The A1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A1, Square::make_square(Rank::First, File::A));
Source

pub const B1: Square

The B1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B1, Square::make_square(Rank::First, File::B));
Source

pub const C1: Square

The C1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C1, Square::make_square(Rank::First, File::C));
Source

pub const D1: Square

The D1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D1, Square::make_square(Rank::First, File::D));
Source

pub const E1: Square

The E1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E1, Square::make_square(Rank::First, File::E));
Source

pub const F1: Square

The F1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F1, Square::make_square(Rank::First, File::F));
Source

pub const G1: Square

The G1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G1, Square::make_square(Rank::First, File::G));
Source

pub const H1: Square

The H1 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H1, Square::make_square(Rank::First, File::H));
Source

pub const A2: Square

The A2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A2, Square::make_square(Rank::Second, File::A));
Source

pub const B2: Square

The B2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B2, Square::make_square(Rank::Second, File::B));
Source

pub const C2: Square

The C2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C2, Square::make_square(Rank::Second, File::C));
Source

pub const D2: Square

The D2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D2, Square::make_square(Rank::Second, File::D));
Source

pub const E2: Square

The E2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E2, Square::make_square(Rank::Second, File::E));
Source

pub const F2: Square

The F2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F2, Square::make_square(Rank::Second, File::F));
Source

pub const G2: Square

The G2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G2, Square::make_square(Rank::Second, File::G));
Source

pub const H2: Square

The H2 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H2, Square::make_square(Rank::Second, File::H));
Source

pub const A3: Square

The A3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A3, Square::make_square(Rank::Third, File::A));
Source

pub const B3: Square

The B3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B3, Square::make_square(Rank::Third, File::B));
Source

pub const C3: Square

The C3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C3, Square::make_square(Rank::Third, File::C));
Source

pub const D3: Square

The D3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D3, Square::make_square(Rank::Third, File::D));
Source

pub const E3: Square

The E3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E3, Square::make_square(Rank::Third, File::E));
Source

pub const F3: Square

The F3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F3, Square::make_square(Rank::Third, File::F));
Source

pub const G3: Square

The G3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G3, Square::make_square(Rank::Third, File::G));
Source

pub const H3: Square

The H3 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H3, Square::make_square(Rank::Third, File::H));
Source

pub const A4: Square

The A4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A4, Square::make_square(Rank::Fourth, File::A));
Source

pub const B4: Square

The B4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B4, Square::make_square(Rank::Fourth, File::B));
Source

pub const C4: Square

The C4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C4, Square::make_square(Rank::Fourth, File::C));
Source

pub const D4: Square

The D4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D4, Square::make_square(Rank::Fourth, File::D));
Source

pub const E4: Square

The E4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E4, Square::make_square(Rank::Fourth, File::E));
Source

pub const F4: Square

The F4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F4, Square::make_square(Rank::Fourth, File::F));
Source

pub const G4: Square

The G4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G4, Square::make_square(Rank::Fourth, File::G));
Source

pub const H4: Square

The H4 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H4, Square::make_square(Rank::Fourth, File::H));
Source

pub const A5: Square

The A5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A5, Square::make_square(Rank::Fifth, File::A));
Source

pub const B5: Square

The B5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B5, Square::make_square(Rank::Fifth, File::B));
Source

pub const C5: Square

The C5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C5, Square::make_square(Rank::Fifth, File::C));
Source

pub const D5: Square

The D5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D5, Square::make_square(Rank::Fifth, File::D));
Source

pub const E5: Square

The E5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E5, Square::make_square(Rank::Fifth, File::E));
Source

pub const F5: Square

The F5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F5, Square::make_square(Rank::Fifth, File::F));
Source

pub const G5: Square

The G5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G5, Square::make_square(Rank::Fifth, File::G));
Source

pub const H5: Square

The H5 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H5, Square::make_square(Rank::Fifth, File::H));
Source

pub const A6: Square

The A6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A6, Square::make_square(Rank::Sixth, File::A));
Source

pub const B6: Square

The B6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B6, Square::make_square(Rank::Sixth, File::B));
Source

pub const C6: Square

The C6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C6, Square::make_square(Rank::Sixth, File::C));
Source

pub const D6: Square

The D6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D6, Square::make_square(Rank::Sixth, File::D));
Source

pub const E6: Square

The E6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E6, Square::make_square(Rank::Sixth, File::E));
Source

pub const F6: Square

The F6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F6, Square::make_square(Rank::Sixth, File::F));
Source

pub const G6: Square

The G6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G6, Square::make_square(Rank::Sixth, File::G));
Source

pub const H6: Square

The H6 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H6, Square::make_square(Rank::Sixth, File::H));
Source

pub const A7: Square

The A7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A7, Square::make_square(Rank::Seventh, File::A));
Source

pub const B7: Square

The B7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B7, Square::make_square(Rank::Seventh, File::B));
Source

pub const C7: Square

The C7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C7, Square::make_square(Rank::Seventh, File::C));
Source

pub const D7: Square

The D7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D7, Square::make_square(Rank::Seventh, File::D));
Source

pub const E7: Square

The E7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E7, Square::make_square(Rank::Seventh, File::E));
Source

pub const F7: Square

The F7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F7, Square::make_square(Rank::Seventh, File::F));
Source

pub const G7: Square

The G7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G7, Square::make_square(Rank::Seventh, File::G));
Source

pub const H7: Square

The H7 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H7, Square::make_square(Rank::Seventh, File::H));
Source

pub const A8: Square

The A8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::A8, Square::make_square(Rank::Eighth, File::A));
Source

pub const B8: Square

The B8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::B8, Square::make_square(Rank::Eighth, File::B));
Source

pub const C8: Square

The C8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::C8, Square::make_square(Rank::Eighth, File::C));
Source

pub const D8: Square

The D8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::D8, Square::make_square(Rank::Eighth, File::D));
Source

pub const E8: Square

The E8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::E8, Square::make_square(Rank::Eighth, File::E));
Source

pub const F8: Square

The F8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::F8, Square::make_square(Rank::Eighth, File::F));
Source

pub const G8: Square

The G8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::G8, Square::make_square(Rank::Eighth, File::G));
Source

pub const H8: Square

The H8 square on the chess board

use candidate::{Square, Rank, File};

assert_eq!(Square::H8, Square::make_square(Rank::Eighth, File::H));
Source

pub unsafe fn new(sq: u8) -> Square

Create a new square, given an index. Note: It is invalid, but allowed, to pass in a number >= 64. Doing so will crash stuff.


use candidate::{Square, Rank, File, EMPTY};

assert_eq!(unsafe { Square::new(0) }, Square::default());

let bad_sq = unsafe { Square::new(64) };

// Iterate over all possible squares and ensure that *none* of them are equal to `bad_sq`.
for sq in !EMPTY {
    assert_ne!(bad_sq, sq);
}
Source

pub fn make_square(rank: Rank, file: File) -> Square

Make a square given a rank and a file

use candidate::{Square, Rank, File, BitBoard};

// Make the A1 square
let sq = Square::make_square(Rank::First, File::A);

// Convert it to a bitboard
let bb = BitBoard::from_square(sq);

// loop over all squares in the bitboard (should be only one), and ensure that the square
// is what we created
for x in bb {
    assert_eq!(sq, x);
}
Source

pub fn get_rank(&self) -> Rank

Return the rank given this square.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.get_rank(), Rank::Seventh);
Source

pub fn get_file(&self) -> File

Return the file given this square.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.get_file(), File::D);
Source

pub fn up(&self) -> Option<Square>

If there is a square above me, return that. Otherwise, None.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.up().expect("Valid Square"), Square::make_square(Rank::Eighth, File::D));

assert_eq!(sq.up().expect("Valid Square").up(), None);
Source

pub fn down(&self) -> Option<Square>

If there is a square below me, return that. Otherwise, None.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.down().expect("Valid Square"), Square::make_square(Rank::First, File::D));

assert_eq!(sq.down().expect("Valid Square").down(), None);
Source

pub fn left(&self) -> Option<Square>

If there is a square to the left of me, return that. Otherwise, None.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::B);

assert_eq!(sq.left().expect("Valid Square"), Square::make_square(Rank::Seventh, File::A));

assert_eq!(sq.left().expect("Valid Square").left(), None);
Source

pub fn right(&self) -> Option<Square>

If there is a square to the right of me, return that. Otherwise, None.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::G);

assert_eq!(sq.right().expect("Valid Square"), Square::make_square(Rank::Seventh, File::H));

assert_eq!(sq.right().expect("Valid Square").right(), None);
Source

pub fn forward(&self, color: Color) -> Option<Square>

If there is a square “forward”, given my Color, go in that direction. Otherwise, None.

use candidate::{Square, Rank, File, Color};

let mut sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.forward(Color::White).expect("Valid Square"), Square::make_square(Rank::Eighth, File::D));
assert_eq!(sq.forward(Color::White).expect("Valid Square").forward(Color::White), None);

sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.forward(Color::Black).expect("Valid Square"), Square::make_square(Rank::First, File::D));
assert_eq!(sq.forward(Color::Black).expect("Valid Square").forward(Color::Black), None);
Source

pub fn backward(&self, color: Color) -> Option<Square>

If there is a square “backward” given my Color, go in that direction. Otherwise, None.

use candidate::{Square, Rank, File, Color};

let mut sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.backward(Color::Black).expect("Valid Square"), Square::make_square(Rank::Eighth, File::D));
assert_eq!(sq.backward(Color::Black).expect("Valid Square").backward(Color::Black), None);

sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.backward(Color::White).expect("Valid Square"), Square::make_square(Rank::First, File::D));
assert_eq!(sq.backward(Color::White).expect("Valid Square").backward(Color::White), None);
Source

pub fn uup(&self) -> Square

If there is a square above me, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.uup(), Square::make_square(Rank::Eighth, File::D));

assert_eq!(sq.uup().uup(), Square::make_square(Rank::First, File::D));
Source

pub fn udown(&self) -> Square

If there is a square below me, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.udown(), Square::make_square(Rank::First, File::D));

assert_eq!(sq.udown().udown(), Square::make_square(Rank::Eighth, File::D));
Source

pub fn uleft(&self) -> Square

If there is a square to the left of me, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::B);

assert_eq!(sq.uleft(), Square::make_square(Rank::Seventh, File::A));

assert_eq!(sq.uleft().uleft(), Square::make_square(Rank::Seventh, File::H));
Source

pub fn uright(&self) -> Square

If there is a square to the right of me, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File};

let sq = Square::make_square(Rank::Seventh, File::G);

assert_eq!(sq.uright(), Square::make_square(Rank::Seventh, File::H));

assert_eq!(sq.uright().uright(), Square::make_square(Rank::Seventh, File::A));
Source

pub fn uforward(&self, color: Color) -> Square

If there is a square “forward”, given my color, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File, Color};

let mut sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.uforward(Color::White), Square::make_square(Rank::Eighth, File::D));
assert_eq!(sq.uforward(Color::White).uforward(Color::White), Square::make_square(Rank::First, File::D));

sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.uforward(Color::Black), Square::make_square(Rank::First, File::D));
assert_eq!(sq.uforward(Color::Black).uforward(Color::Black), Square::make_square(Rank::Eighth, File::D));
Source

pub fn ubackward(&self, color: Color) -> Square

If there is a square “backward”, given my color, return that. If not, wrap around to the other side.

use candidate::{Square, Rank, File, Color};

let mut sq = Square::make_square(Rank::Seventh, File::D);

assert_eq!(sq.ubackward(Color::Black), Square::make_square(Rank::Eighth, File::D));
assert_eq!(sq.ubackward(Color::Black).ubackward(Color::Black), Square::make_square(Rank::First, File::D));

sq = Square::make_square(Rank::Second, File::D);

assert_eq!(sq.ubackward(Color::White), Square::make_square(Rank::First, File::D));
assert_eq!(sq.ubackward(Color::White).ubackward(Color::White), Square::make_square(Rank::Eighth, File::D));
Source

pub fn to_int(&self) -> u8

Convert this square to an integer.

use candidate::{Square, Rank, File};

assert_eq!(Square::make_square(Rank::First, File::A).to_int(), 0);
assert_eq!(Square::make_square(Rank::Second, File::A).to_int(), 8);
assert_eq!(Square::make_square(Rank::First, File::B).to_int(), 1);
assert_eq!(Square::make_square(Rank::Eighth, File::H).to_int(), 63);
Source

pub fn to_index(&self) -> usize

Convert this Square to a usize for table lookup purposes

use candidate::{Square, Rank, File};

assert_eq!(Square::make_square(Rank::First, File::A).to_index(), 0);
assert_eq!(Square::make_square(Rank::Second, File::A).to_index(), 8);
assert_eq!(Square::make_square(Rank::First, File::B).to_index(), 1);
assert_eq!(Square::make_square(Rank::Eighth, File::H).to_index(), 63);
Source

pub fn from_string(s: String) -> Option<Square>

👎Deprecated since 3.1.0: please use Square::from_str(square)? instead

Convert a UCI String to a square. If invalid, return None

use candidate::Square;

let sq = Square::default();

assert_eq!(Square::from_string("a1".to_owned()).expect("Valid Square"), sq);

Trait Implementations§

Source§

impl Clone for Square

Source§

fn clone(&self) -> Square

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Square

Source§

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

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

impl Default for Square

Source§

fn default() -> Square

Create a square on A1.

use candidate::{Square, Rank, File};

let explicit_sq = Square::make_square(Rank::First, File::A);
let implicit_sq = Square::default();

assert_eq!(explicit_sq, implicit_sq);
Source§

impl Display for Square

Source§

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

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

impl FromStr for Square

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Square

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<Square> for BoardBuilder

Source§

type Output = Option<(Piece, Color)>

The returned type after indexing.
Source§

fn index<'a>(&'a self, index: Square) -> &'a Self::Output

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

impl IndexMut<Square> for BoardBuilder

Source§

fn index_mut<'a>(&'a mut self, index: Square) -> &'a mut Self::Output

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

impl Ord for Square

Source§

fn cmp(&self, other: &Square) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Square

Source§

fn eq(&self, other: &Square) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Square

Source§

fn partial_cmp(&self, other: &Square) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Square

Source§

impl Eq for Square

Source§

impl StructuralPartialEq for Square

Auto Trait Implementations§

§

impl Freeze for Square

§

impl RefUnwindSafe for Square

§

impl Send for Square

§

impl Sync for Square

§

impl Unpin for Square

§

impl UnwindSafe for Square

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.