Struct static_math::vector2::V2 [−][src]
pub struct V2<T>(_);
Implementations
Methods from Deref<Target = [T; 2]>
pub fn as_slice(&self) -> &[T]
[src]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn as_slice(&self) -> &[T]
[src]array_methods
)Returns a slice containing the entire array. Equivalent to &s[..]
.
pub fn as_mut_slice(&mut self) -> &mut [T]
[src]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn as_mut_slice(&mut self) -> &mut [T]
[src]array_methods
)Returns a mutable slice containing the entire array. Equivalent to
&mut s[..]
.
pub fn each_ref(&self) -> [&T; N]
[src]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn each_ref(&self) -> [&T; N]
[src]array_methods
)Borrows each element and returns an array of references with the same
size as self
.
Example
#![feature(array_methods)] let floats = [3.1, 2.7, -1.0]; let float_refs: [&f64; 3] = floats.each_ref(); assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
This method is particularly useful if combined with other methods, like
map
. This way, you can avoid moving the original
array if its elements are not Copy
.
#![feature(array_methods, array_map)] let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()]; let is_ascii = strings.each_ref().map(|s| s.is_ascii()); assert_eq!(is_ascii, [true, false, true]); // We can still access the original array: it has not been moved. assert_eq!(strings.len(), 3);
pub fn each_mut(&mut self) -> [&mut T; N]
[src]
🔬 This is a nightly-only experimental API. (array_methods
)
pub fn each_mut(&mut self) -> [&mut T; N]
[src]array_methods
)Borrows each element mutably and returns an array of mutable references
with the same size as self
.
Example
#![feature(array_methods)] let mut floats = [3.1, 2.7, -1.0]; let float_refs: [&mut f64; 3] = floats.each_mut(); *float_refs[0] = 0.0; assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]); assert_eq!(floats, [0.0, 2.7, -1.0]);
Trait Implementations
impl<T: Num + Copy> AddAssign<V2<T>> for V2<T>
[src]
impl<T: Num + Copy> AddAssign<V2<T>> for V2<T>
[src]fn add_assign(&mut self, other: Self)
[src]
fn add_assign(&mut self, other: Self)
[src]Performs the +=
operation. Read more
impl<T: Num + Copy> SubAssign<V2<T>> for V2<T>
[src]
impl<T: Num + Copy> SubAssign<V2<T>> for V2<T>
[src]fn sub_assign(&mut self, other: Self)
[src]
fn sub_assign(&mut self, other: Self)
[src]Performs the -=
operation. Read more
impl<T: Copy> Copy for V2<T>
[src]
impl<T> StructuralPartialEq for V2<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for V2<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for V2<T> where
T: Send,
T: Send,
impl<T> Sync for V2<T> where
T: Sync,
T: Sync,
impl<T> Unpin for V2<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for V2<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more