pub struct Vec3 {
pub x: i16,
pub y: i16,
pub z: i16,
}
Expand description
A 2D vector with signed integer coordinates.
This struct is used to represent positions or dimensions where negative values are applicable.
§Examples
use int_math::prelude::*;
let position = Vec3::new(-5, 10, 0);
println!("{:?}", position); // Output: Vec3 { x: -5, y: 10 }
§Fields
x
: The bottom-left x-coordinate (horizontal position) of the vector.y
: The bottom-left y-coordinate (vertical position) of the vector.z
: The z-coordinate (depth position) of the vector.
Fields§
§x: i16
§y: i16
§z: i16
Implementations§
Source§impl Vec3
impl Vec3
Sourcepub const fn new(x: i16, y: i16, z: i16) -> Vec3
pub const fn new(x: i16, y: i16, z: i16) -> Vec3
Creates a new Vec2
instance with the specified coordinates.
§Arguments
x
: The bottom-left x-coordinate of the vector.y
: The bottom-left y-coordinate of the vector.
§Examples
use int_math::prelude::*;
let vector = Vec3::new(-5, 10, -99);
assert_eq!(vector.x, -5);
assert_eq!(vector.y, 10);
assert_eq!(vector.z, -99);
Trait Implementations§
impl Copy for Vec3
impl Eq for Vec3
impl StructuralPartialEq for Vec3
Auto Trait Implementations§
impl Freeze for Vec3
impl RefUnwindSafe for Vec3
impl Send for Vec3
impl Sync for Vec3
impl Unpin for Vec3
impl UnwindSafe for Vec3
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more