Struct minorhacks_chess::Square [−][src]
pub struct Square(_);
Represent a square on the chess board
Implementations
impl Square
[src]
impl Square
[src]pub unsafe fn new(sq: u8) -> Square
[src]
pub unsafe fn new(sq: u8) -> Square
[src]Create a new square, given an index.
Safety
It is invalid, but allowed, to pass in a number >= 64. Doing so will crash stuff.
use minorhacks_chess::{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); }
pub fn make_square(rank: Rank, file: File) -> Square
[src]
pub fn make_square(rank: Rank, file: File) -> Square
[src]Make a square given a rank and a file
use minorhacks_chess::{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); }
pub fn get_rank(&self) -> Rank
[src]
pub fn get_rank(&self) -> Rank
[src]Return the rank given this square.
use minorhacks_chess::{Square, Rank, File}; let sq = Square::make_square(Rank::Seventh, File::D); assert_eq!(sq.get_rank(), Rank::Seventh);
pub fn get_file(&self) -> File
[src]
pub fn get_file(&self) -> File
[src]Return the file given this square.
use minorhacks_chess::{Square, Rank, File}; let sq = Square::make_square(Rank::Seventh, File::D); assert_eq!(sq.get_file(), File::D);
pub fn up(&self) -> Option<Square>
[src]
pub fn up(&self) -> Option<Square>
[src]If there is a square above me, return that. Otherwise, None.
use minorhacks_chess::{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);
pub fn down(&self) -> Option<Square>
[src]
pub fn down(&self) -> Option<Square>
[src]If there is a square below me, return that. Otherwise, None.
use minorhacks_chess::{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);
pub fn left(&self) -> Option<Square>
[src]
pub fn left(&self) -> Option<Square>
[src]If there is a square to the left of me, return that. Otherwise, None.
use minorhacks_chess::{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);
pub fn right(&self) -> Option<Square>
[src]
pub fn right(&self) -> Option<Square>
[src]If there is a square to the right of me, return that. Otherwise, None.
use minorhacks_chess::{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);
pub fn forward(&self, color: Color) -> Option<Square>
[src]
pub fn forward(&self, color: Color) -> Option<Square>
[src]If there is a square “forward”, given my Color
, go in that direction. Otherwise, None.
use minorhacks_chess::{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);
pub fn backward(&self, color: Color) -> Option<Square>
[src]
pub fn backward(&self, color: Color) -> Option<Square>
[src]If there is a square “backward” given my Color
, go in that direction. Otherwise, None.
use minorhacks_chess::{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);
pub fn uup(&self) -> Square
[src]
pub fn uup(&self) -> Square
[src]If there is a square above me, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn udown(&self) -> Square
[src]
pub fn udown(&self) -> Square
[src]If there is a square below me, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn uleft(&self) -> Square
[src]
pub fn uleft(&self) -> Square
[src]If there is a square to the left of me, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn uright(&self) -> Square
[src]
pub fn uright(&self) -> Square
[src]If there is a square to the right of me, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn uforward(&self, color: Color) -> Square
[src]
pub fn uforward(&self, color: Color) -> Square
[src]If there is a square “forward”, given my color, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn ubackward(&self, color: Color) -> Square
[src]
pub fn ubackward(&self, color: Color) -> Square
[src]If there is a square “backward”, given my color, return that. If not, wrap around to the other side.
use minorhacks_chess::{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));
pub fn to_int(&self) -> u8
[src]
pub fn to_int(&self) -> u8
[src]Convert this square to an integer.
use minorhacks_chess::{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);
pub fn to_index(&self) -> usize
[src]
pub fn to_index(&self) -> usize
[src]Convert this Square
to a usize
for table lookup purposes
use minorhacks_chess::{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);
pub fn from_string(s: String) -> Option<Square>
[src]
👎 Deprecated since 3.1.0: please use Square::from_str(square)?
instead
pub fn from_string(s: String) -> Option<Square>
[src]please use Square::from_str(square)?
instead
Convert a UCI String
to a square. If invalid, return None
use minorhacks_chess::Square; let sq = Square::default(); assert_eq!(Square::from_string("a1".to_owned()).expect("Valid Square"), sq);
pub const A1: Square
[src]
pub const A1: Square
[src]The A1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A1, Square::make_square(Rank::First, File::A));
pub const B1: Square
[src]
pub const B1: Square
[src]The B1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B1, Square::make_square(Rank::First, File::B));
pub const C1: Square
[src]
pub const C1: Square
[src]The C1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C1, Square::make_square(Rank::First, File::C));
pub const D1: Square
[src]
pub const D1: Square
[src]The D1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D1, Square::make_square(Rank::First, File::D));
pub const E1: Square
[src]
pub const E1: Square
[src]The E1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E1, Square::make_square(Rank::First, File::E));
pub const F1: Square
[src]
pub const F1: Square
[src]The F1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F1, Square::make_square(Rank::First, File::F));
pub const G1: Square
[src]
pub const G1: Square
[src]The G1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G1, Square::make_square(Rank::First, File::G));
pub const H1: Square
[src]
pub const H1: Square
[src]The H1 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H1, Square::make_square(Rank::First, File::H));
pub const A2: Square
[src]
pub const A2: Square
[src]The A2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A2, Square::make_square(Rank::Second, File::A));
pub const B2: Square
[src]
pub const B2: Square
[src]The B2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B2, Square::make_square(Rank::Second, File::B));
pub const C2: Square
[src]
pub const C2: Square
[src]The C2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C2, Square::make_square(Rank::Second, File::C));
pub const D2: Square
[src]
pub const D2: Square
[src]The D2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D2, Square::make_square(Rank::Second, File::D));
pub const E2: Square
[src]
pub const E2: Square
[src]The E2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E2, Square::make_square(Rank::Second, File::E));
pub const F2: Square
[src]
pub const F2: Square
[src]The F2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F2, Square::make_square(Rank::Second, File::F));
pub const G2: Square
[src]
pub const G2: Square
[src]The G2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G2, Square::make_square(Rank::Second, File::G));
pub const H2: Square
[src]
pub const H2: Square
[src]The H2 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H2, Square::make_square(Rank::Second, File::H));
pub const A3: Square
[src]
pub const A3: Square
[src]The A3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A3, Square::make_square(Rank::Third, File::A));
pub const B3: Square
[src]
pub const B3: Square
[src]The B3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B3, Square::make_square(Rank::Third, File::B));
pub const C3: Square
[src]
pub const C3: Square
[src]The C3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C3, Square::make_square(Rank::Third, File::C));
pub const D3: Square
[src]
pub const D3: Square
[src]The D3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D3, Square::make_square(Rank::Third, File::D));
pub const E3: Square
[src]
pub const E3: Square
[src]The E3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E3, Square::make_square(Rank::Third, File::E));
pub const F3: Square
[src]
pub const F3: Square
[src]The F3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F3, Square::make_square(Rank::Third, File::F));
pub const G3: Square
[src]
pub const G3: Square
[src]The G3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G3, Square::make_square(Rank::Third, File::G));
pub const H3: Square
[src]
pub const H3: Square
[src]The H3 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H3, Square::make_square(Rank::Third, File::H));
pub const A4: Square
[src]
pub const A4: Square
[src]The A4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A4, Square::make_square(Rank::Fourth, File::A));
pub const B4: Square
[src]
pub const B4: Square
[src]The B4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B4, Square::make_square(Rank::Fourth, File::B));
pub const C4: Square
[src]
pub const C4: Square
[src]The C4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C4, Square::make_square(Rank::Fourth, File::C));
pub const D4: Square
[src]
pub const D4: Square
[src]The D4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D4, Square::make_square(Rank::Fourth, File::D));
pub const E4: Square
[src]
pub const E4: Square
[src]The E4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E4, Square::make_square(Rank::Fourth, File::E));
pub const F4: Square
[src]
pub const F4: Square
[src]The F4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F4, Square::make_square(Rank::Fourth, File::F));
pub const G4: Square
[src]
pub const G4: Square
[src]The G4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G4, Square::make_square(Rank::Fourth, File::G));
pub const H4: Square
[src]
pub const H4: Square
[src]The H4 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H4, Square::make_square(Rank::Fourth, File::H));
pub const A5: Square
[src]
pub const A5: Square
[src]The A5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A5, Square::make_square(Rank::Fifth, File::A));
pub const B5: Square
[src]
pub const B5: Square
[src]The B5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B5, Square::make_square(Rank::Fifth, File::B));
pub const C5: Square
[src]
pub const C5: Square
[src]The C5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C5, Square::make_square(Rank::Fifth, File::C));
pub const D5: Square
[src]
pub const D5: Square
[src]The D5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D5, Square::make_square(Rank::Fifth, File::D));
pub const E5: Square
[src]
pub const E5: Square
[src]The E5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E5, Square::make_square(Rank::Fifth, File::E));
pub const F5: Square
[src]
pub const F5: Square
[src]The F5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F5, Square::make_square(Rank::Fifth, File::F));
pub const G5: Square
[src]
pub const G5: Square
[src]The G5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G5, Square::make_square(Rank::Fifth, File::G));
pub const H5: Square
[src]
pub const H5: Square
[src]The H5 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H5, Square::make_square(Rank::Fifth, File::H));
pub const A6: Square
[src]
pub const A6: Square
[src]The A6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A6, Square::make_square(Rank::Sixth, File::A));
pub const B6: Square
[src]
pub const B6: Square
[src]The B6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B6, Square::make_square(Rank::Sixth, File::B));
pub const C6: Square
[src]
pub const C6: Square
[src]The C6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C6, Square::make_square(Rank::Sixth, File::C));
pub const D6: Square
[src]
pub const D6: Square
[src]The D6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D6, Square::make_square(Rank::Sixth, File::D));
pub const E6: Square
[src]
pub const E6: Square
[src]The E6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E6, Square::make_square(Rank::Sixth, File::E));
pub const F6: Square
[src]
pub const F6: Square
[src]The F6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F6, Square::make_square(Rank::Sixth, File::F));
pub const G6: Square
[src]
pub const G6: Square
[src]The G6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G6, Square::make_square(Rank::Sixth, File::G));
pub const H6: Square
[src]
pub const H6: Square
[src]The H6 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H6, Square::make_square(Rank::Sixth, File::H));
pub const A7: Square
[src]
pub const A7: Square
[src]The A7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A7, Square::make_square(Rank::Seventh, File::A));
pub const B7: Square
[src]
pub const B7: Square
[src]The B7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B7, Square::make_square(Rank::Seventh, File::B));
pub const C7: Square
[src]
pub const C7: Square
[src]The C7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C7, Square::make_square(Rank::Seventh, File::C));
pub const D7: Square
[src]
pub const D7: Square
[src]The D7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D7, Square::make_square(Rank::Seventh, File::D));
pub const E7: Square
[src]
pub const E7: Square
[src]The E7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E7, Square::make_square(Rank::Seventh, File::E));
pub const F7: Square
[src]
pub const F7: Square
[src]The F7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F7, Square::make_square(Rank::Seventh, File::F));
pub const G7: Square
[src]
pub const G7: Square
[src]The G7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::G7, Square::make_square(Rank::Seventh, File::G));
pub const H7: Square
[src]
pub const H7: Square
[src]The H7 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::H7, Square::make_square(Rank::Seventh, File::H));
pub const A8: Square
[src]
pub const A8: Square
[src]The A8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::A8, Square::make_square(Rank::Eighth, File::A));
pub const B8: Square
[src]
pub const B8: Square
[src]The B8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::B8, Square::make_square(Rank::Eighth, File::B));
pub const C8: Square
[src]
pub const C8: Square
[src]The C8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::C8, Square::make_square(Rank::Eighth, File::C));
pub const D8: Square
[src]
pub const D8: Square
[src]The D8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::D8, Square::make_square(Rank::Eighth, File::D));
pub const E8: Square
[src]
pub const E8: Square
[src]The E8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::E8, Square::make_square(Rank::Eighth, File::E));
pub const F8: Square
[src]
pub const F8: Square
[src]The F8 square on the chess board
use minorhacks_chess::{Square, Rank, File}; assert_eq!(Square::F8, Square::make_square(Rank::Eighth, File::F));
Trait Implementations
impl Index<Square> for BoardBuilder
[src]
impl Index<Square> for BoardBuilder
[src]impl IndexMut<Square> for BoardBuilder
[src]
impl IndexMut<Square> for BoardBuilder
[src]impl Ord for Square
[src]
impl Ord for Square
[src]impl PartialOrd<Square> for Square
[src]
impl PartialOrd<Square> for Square
[src]fn partial_cmp(&self, other: &Square) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Square) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Square
[src]
impl Eq for Square
[src]
impl StructuralEq for Square
[src]
impl StructuralPartialEq for Square
[src]
Auto Trait Implementations
impl RefUnwindSafe for Square
impl Send for Square
impl Sync for Square
impl Unpin for Square
impl UnwindSafe for Square
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more