[−][src]Struct gridly::vector::Vector
A measurement of distance between two [Location
]s
A Vector
is the measurement of distance between two [Location
]s. It
supports arithmetic operations with itself, as well as anything which can
be converted into a Vector. Currently, Rows
, Columns
, and Direction
all have this property, as well as a tuple of (Into
Fields
rows: Rows
columns: Columns
Methods
impl Vector
[src]
pub fn new(rows: impl Into<Rows>, columns: impl Into<Columns>) -> Self
[src]
Create a new Vector
pub const fn zero() -> Vector
[src]
Create a zero Vector
pub const fn upward(size: isize) -> Vector
[src]
Create an upward pointing vector of the given size
pub const fn downward(size: isize) -> Vector
[src]
Create a downward pointing vector of the given size
pub const fn leftward(size: isize) -> Vector
[src]
Create a leftward pointing vector of the given size
pub const fn rightward(size: isize) -> Vector
[src]
Create a rightward pointing vector of the given size
pub fn in_direction(direction: Direction, length: isize) -> Vector
[src]
Create a vector of the given size in the given direction
Trait Implementations
impl VectorLike for Vector
[src]
fn rows(&self) -> Rows
[src]
fn columns(&self) -> Columns
[src]
fn as_vector(&self) -> Vector
[src]
fn manhattan_length(&self) -> isize
[src]
fn checked_manhattan_length(&self) -> Option<isize>
[src]
fn clockwise(&self) -> Vector
[src]
fn anticlockwise(&self) -> Vector
[src]
fn reverse(&self) -> Vector
[src]
fn get_component<T: Component>(&self) -> T
[src]
fn transpose(&self) -> Vector
[src]
fn direction(&self) -> Option<Direction>
[src]
impl Eq for Vector
[src]
impl Default for Vector
[src]
impl Clone for Vector
[src]
impl<T: VectorLike> PartialOrd<T> for Vector
[src]
fn partial_cmp(&self, rhs: &T) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: VectorLike> PartialEq<T> for Vector
[src]
impl Copy for Vector
[src]
impl Hash for Vector
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: VectorLike> Add<T> for Vector
[src]
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Vector
[src]
impl<T: VectorLike> Sub<T> for Vector
[src]
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Vector
[src]
impl<T: Copy> Mul<T> for Vector where
isize: Mul<T, Output = isize>,
[src]
isize: Mul<T, Output = isize>,
Multiply a vector's components by a constant factor
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, factor: T) -> Vector
[src]
impl Neg for Vector
[src]
impl<T: VectorLike> AddAssign<T> for Vector
[src]
fn add_assign(&mut self, rhs: T)
[src]
impl<T: VectorLike> SubAssign<T> for Vector
[src]
fn sub_assign(&mut self, rhs: T)
[src]
impl<T: Copy> MulAssign<T> for Vector where
isize: MulAssign<T>,
[src]
isize: MulAssign<T>,
Multiply a vector's components by a constant factor in-place
fn mul_assign(&mut self, factor: T)
[src]
impl Debug for Vector
[src]
Auto Trait Implementations
impl Send for Vector
impl Unpin for Vector
impl Sync for Vector
impl UnwindSafe for Vector
impl RefUnwindSafe for Vector
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,