pub struct Tile {
pub directions: Vec<Direction>,
}Fields§
§directions: Vec<Direction>Implementations§
Source§impl Tile
impl Tile
pub fn new(directions: Vec<Direction>) -> Self
pub fn box_tile() -> Self
pub fn t_tile(length: usize) -> Self
Sourcepub fn rotate(&self) -> Tile
pub fn rotate(&self) -> Tile
Returns a rotated (by 90 degrees clockwise) copy of this tile.
§Examples
use dcc_tiler::tile::{Tile, Direction};
let l = Tile::new(vec![Direction::Left, Direction::Up, Direction::Left]);
let q = Tile::new(vec![Direction::Up, Direction::Right, Direction::Up]);
assert_eq!(l.rotate(), q);Sourcepub fn reflect(&self, axis: Axis) -> Tile
pub fn reflect(&self, axis: Axis) -> Tile
Returns a reflected (about the specified axis) copy of this tile
§Examples
use dcc_tiler::tile::{Tile, Direction, Axis};
let tile = Tile::new(vec![Direction::Left, Direction::Up, Direction::Right]);
// Reflect our tile about a vertical line
let reflected_tile = tile.reflect(Axis::Vertical);
assert_eq!(reflected_tile, Tile::new(vec![Direction::Right, Direction::Up, Direction::Left]));Trait Implementations§
Source§impl From<Tile> for TileCollection
impl From<Tile> for TileCollection
impl Eq for Tile
impl StructuralPartialEq for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
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