VectorGrid

Struct VectorGrid 

Source
pub struct VectorGrid<ItemType> { /* private fields */ }
Expand description
▣▦▥▩╱̅̅╲▜▄‾‾‾‾█╲▜█▀▀▀▀‾̅̅╲‾▄█▀▀▀▙╲▀▀▜▄▀▀‾̅̅╲‾▄█▀▀▀▙╲▜█▀▀▀▇‾╲
▧◤  ╱╲╱╲ ▜▄  █ ╲▜█▀▀▀  ╲▜      ╲  ▜▄   ╲▜     █╲▜█▄▄▛  ╲
    ╱╲╱╲╱╲__̲▜██__̲╲̲▜█▄▄▄▄_̲╲_̲▀▇▇▀_̲╲___̲▜▄__̲╲_̲▀▇▇▀_̲_̲╲̲▀█▄_̲▀▙_̲╲
    ╲╱╲╱╲̲╱_̲╱_̲╱_̲╱_̲╱ ▟███▙ ╱▟███▙ ╱  ▟▛  ╱ ▟██▇▄  ̲╱_̲╱_̲╱_̲╱_╱
     ╲╱╲̲╱_̲╱_̲╱_̲╱_̲╱ ▟▛ ▄▄ ╱▟█▄▄▛ ╱  ▟▛  ╱ ▟▛ ▟▛ ̲╱_̲╱_̲╱_̲╱_╱
      ╲̲╱_̲╱_̲╱_̲╱_̲╱__̲▜██▛_̲╱▟█_̲▜▙╱__▟▛__̲╱_̲▟██▇▀̲▀__̲╱_̲╱_̲╱_̲╱_╱
 

Implementations§

Source§

impl<ItemType: VectorGridItemDisplay> VectorGrid<ItemType>

Source

pub fn print(&self)

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn cut(&mut self, dimension: usize, range: Range<usize>)

Source§

impl<ItemType: Default + Clone> VectorGrid<ItemType>

Source

pub fn extend_dimension( &mut self, dimension: usize, distance: usize, amount: usize, )

Inserts an amount of layers filled with default items at a specific distance along a dimension

Source

pub fn extend_inwards(&mut self, axis: usize, amount: usize)

Source

pub fn extend_outwards(&mut self, axis: usize, amount: usize)

Source

pub fn scale_to_encompace(&mut self, coordinate: &mut Coordinate)

Source

pub fn extend(&mut self, amount: usize)

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn set_item(&mut self, at: Coordinate, to: ItemType)

Source

pub fn set_item_if_contained(&mut self, at: Coordinate, to: ItemType)

Source§

impl<ItemType: Clone> VectorGrid<ItemType>

Source

pub fn stamp(&mut self, stamp_grid: &VectorGrid<ItemType>, at: Coordinate)

Source§

impl<ItemType: Clone + Default> VectorGrid<ItemType>

Source

pub fn stamp_with_extend( &mut self, stamp_grid: &VectorGrid<ItemType>, at: Coordinate, )

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn from_vector(defined_shape: Vec<usize>, items: Vec<ItemType>) -> Self

Source§

impl<ItemType: Default + Clone> VectorGrid<ItemType>

Source

pub fn from_2d_array<const WIDTH: usize>(array: &[[ItemType; WIDTH]]) -> Self

Source

pub fn new_fill(shape: impl Into<FullShape>) -> Self

Source§

impl<ItemType: Copy> VectorGrid<ItemType>

Source

pub fn get_chunk(&self, chunk_range: Vec<Range<usize>>) -> VectorGrid<ItemType>

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn get_chunk_ref( &self, chunk_range: Vec<Range<usize>>, ) -> VectorGrid<&ItemType>

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn get(&self, at: &Coordinate) -> Option<&ItemType>

Source

pub fn get_mut(&mut self, at: &Coordinate) -> Option<&mut ItemType>

Source§

impl<ItemType: Clone + Default> VectorGrid<ItemType>

Source

pub fn get_or_default(&self, at: &Coordinate) -> ItemType

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn iter(&self) -> Iter<'_, ItemType>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, ItemType>

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn iter_chunk<'a>( &'a self, shape: Vec<Range<usize>>, ) -> IterVectorGridChunk<'a, ItemType>

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn step_sizes(&self) -> Vec<usize>

Source

pub fn step_sizes_i(&self) -> Vec<isize>

Source

pub fn is_inside_grid(&self, at: &Coordinate) -> bool

Source

pub fn get_coordinate_index(&self, at: &Coordinate) -> usize

Source

pub fn get_index_coordinate(&self, at: usize) -> Coordinate

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn len(&self) -> usize

Source

pub fn x_size(&self) -> usize

Source

pub fn y_size(&self) -> usize

Source

pub fn z_size(&self) -> usize

Source

pub fn n_size(&self, n: usize) -> usize

Source

pub fn dimensions(&self) -> usize

Source§

impl<ItemType> VectorGrid<ItemType>

Source

pub fn shape(&self) -> FullShape

Source

pub fn defined_shape(&self) -> &DefinedShape

Source

pub fn defined_shape_usize(&self) -> Vec<usize>

Source

pub fn defined_shape_isize(&self) -> Vec<isize>

Source

pub fn defined_shape_i32(&self) -> Vec<i32>

Source

pub fn items(&self) -> &Vec<ItemType>

Trait Implementations§

Source§

impl<ItemType: Clone> Clone for VectorGrid<ItemType>

Source§

fn clone(&self) -> VectorGrid<ItemType>

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

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

Performs copy-assignment from source. Read more
Source§

impl<ItemType: Debug> Debug for VectorGrid<ItemType>

Source§

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

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

impl<'de, ItemType> Deserialize<'de> for VectorGrid<ItemType>
where ItemType: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<ItemType> Index<&Coordinate> for VectorGrid<ItemType>

Source§

type Output = ItemType

The returned type after indexing.
Source§

fn index(&self, index: &Coordinate) -> &Self::Output

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

impl<ItemType> IndexMut<&Coordinate> for VectorGrid<ItemType>

Source§

fn index_mut(&mut self, index: &Coordinate) -> &mut Self::Output

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

impl<ItemType> Serialize for VectorGrid<ItemType>
where ItemType: Serialize,

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<ItemType> Freeze for VectorGrid<ItemType>

§

impl<ItemType> RefUnwindSafe for VectorGrid<ItemType>
where ItemType: RefUnwindSafe,

§

impl<ItemType> Send for VectorGrid<ItemType>
where ItemType: Send,

§

impl<ItemType> Sync for VectorGrid<ItemType>
where ItemType: Sync,

§

impl<ItemType> Unpin for VectorGrid<ItemType>
where ItemType: Unpin,

§

impl<ItemType> UnwindSafe for VectorGrid<ItemType>
where ItemType: 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,