[][src]Struct beehive::HexMap

pub struct HexMap<T, I = i16> { /* fields omitted */ }

A generic QuadPrism-shaped dense container indexed by hex coordinates.

This type is only available with the collections feature.

Methods

impl<T, I: Subscript> HexMap<T, I>[src]

pub fn create(area: QuadPrism<I>, value: T) -> Self where
    T: Clone
[src]

Creates from a default value for all hexes. T must be Clone.

Panics

If area has a negative volume.

pub fn create_with_axial<F>(area: QuadPrism<I>, initializer: F) -> Self where
    F: FnMut(PointAxial<I>) -> T, 
[src]

Creates with an initializer function that takes axial points.

Panics

If area has a negative volume.

pub fn create_with<F>(area: QuadPrism<I>, initializer: F) -> Self where
    F: FnMut(Point<I>) -> T, 
[src]

Creates with an initializer function that takes cube points.

Panics

If area has a negative volume.

pub fn create_from_axial<U, F>(base: HexMap<U, I>, op: F) -> Self where
    F: FnMut(PointAxial<I>, U) -> T, 
[src]

Creates from an existing HexMap

pub fn create_from<U, F>(base: HexMap<U, I>, op: F) -> Self where
    F: FnMut(Point<I>, U) -> T, 
[src]

Creates from an existing HexMap

pub fn create_from_ref_axial<U, F>(base: &HexMap<U, I>, op: F) -> Self where
    F: FnMut(PointAxial<I>, &U) -> T, 
[src]

Creates from reference of an existing HexMap

pub fn create_from_ref<U, F>(base: &HexMap<U, I>, op: F) -> Self where
    F: FnMut(Point<I>, &U) -> T, 
[src]

Creates from reference of an existing HexMap

pub fn from_raw(area: QuadPrism<I>, data: Vec<T>) -> Self[src]

Creates from a raw data Vec.

Panics

If the sizes of area and data mismatch.

pub fn try_from_raw(
    area: QuadPrism<I>,
    data: Vec<T>
) -> Result<Self, RawSizeMismatch>
[src]

Creates from a raw data Vec.

Errors

If the sizes of area and data mismatch.

pub fn area(&self) -> &QuadPrism<I>[src]

Returns the QuadPrism that this HexMap covers.

pub fn get_axial(&self, point: PointAxial<I>) -> Option<&T>[src]

Returns a reference to a value, or None if the point is out of bounds.

pub fn get(&self, point: Point<I>) -> Option<&T>[src]

Returns a reference to a value, or None if the point is out of bounds.

pub fn get_mut_axial(&mut self, point: PointAxial<I>) -> Option<&mut T>[src]

Returns a mutable reference to a value, or None if the point is out of bounds.

pub fn get_mut(&mut self, point: Point<I>) -> Option<&mut T>[src]

Returns a mutable reference to a value, or None if the point is out of bounds.

pub fn iter_axial(&self) -> IterAxial<T, I>[src]

Returns an iterator that yields axial coordinates and references to corresponding values.

pub fn iter(&self) -> Iter<T, I>[src]

Returns an iterator that yields cube coordinates and references to corresponding values.

pub fn iter_mut_axial(&mut self) -> IterMutAxial<T, I>[src]

Returns an iterator that yields axial coordinates and mutable references to corresponding values.

pub fn iter_mut(&mut self) -> IterMut<T, I>[src]

Returns an iterator that yields cube coordinates and mutable references to corresponding values.

Trait Implementations

impl<T: Clone, I: Clone> Clone for HexMap<T, I>[src]

impl<T: Debug, I: Debug> Debug for HexMap<T, I>[src]

impl<T> Default for HexMap<T>[src]

impl<T: Eq, I: Eq> Eq for HexMap<T, I>[src]

impl<T, I: Subscript> Index<Point<I>> for HexMap<T, I>[src]

type Output = T

The returned type after indexing.

impl<T, I: Subscript> Index<PointAxial<I>> for HexMap<T, I>[src]

type Output = T

The returned type after indexing.

impl<T, I: Subscript> IndexMut<Point<I>> for HexMap<T, I>[src]

impl<T, I: Subscript> IndexMut<PointAxial<I>> for HexMap<T, I>[src]

impl<T: PartialEq, I: PartialEq> PartialEq<HexMap<T, I>> for HexMap<T, I>[src]

impl<T, I> StructuralEq for HexMap<T, I>[src]

impl<T, I> StructuralPartialEq for HexMap<T, I>[src]

Auto Trait Implementations

impl<T, I> RefUnwindSafe for HexMap<T, I> where
    I: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, I> Send for HexMap<T, I> where
    I: Send,
    T: Send

impl<T, I> Sync for HexMap<T, I> where
    I: Sync,
    T: Sync

impl<T, I> Unpin for HexMap<T, I> where
    I: Unpin,
    T: Unpin

impl<T, I> UnwindSafe for HexMap<T, I> where
    I: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.