Struct vox_geometry_rust::array1::Array1 [−][src]
pub struct Array1<T: ZeroInit> { /* fields omitted */ }
Expand description
1-D array accessor class.
This class represents 1-D array accessor. Array accessor provides array-like data read/write functions, but does not handle memory management. Thus, it is more like a random access iterator, but with multi-dimension support.
- tparam T - Array value type.
Implementations
impl<T: ZeroInit> Array1<T>
[src]
impl<T: ZeroInit> Array1<T>
[src]pub fn new_default() -> Array1<T>
[src]
pub fn new_default() -> Array1<T>
[src]Constructs zero-sized 1-D array.
use vox_geometry_rust::array1::Array1; let arr: Array1<f32> = Array1::new_default(); assert_eq!(0, arr.size());
pub fn new(size: usize, init_val: Option<T>) -> Array1<T>
[src]
pub fn new(size: usize, init_val: Option<T>) -> Array1<T>
[src]Constructs 1-D array with given \p size and fill it with \p initVal.
- parameter: size Initial size of the array.
- parameter: initVal Initial value of each array element.
use vox_geometry_rust::array1::Array1; let arr = Array1::new(9, Some(1.5)); assert_eq!(9, arr.size()); for i in 0..9 { assert_eq!(1.5, arr[i]); }
pub fn new_lst(lst: Vec<T>) -> Array1<T>
[src]
pub fn new_lst(lst: Vec<T>) -> Array1<T>
[src]\brief Constructs 1-D array with given initializer list \p lst.
This constructor will build 1-D array with given initializer list \p lst such as
use vox_geometry_rust::array1::Array1; let arr: Array1<f32> = Array1::new_lst(vec![1.0, 2.0, 4.0, 9.0, 3.0]);
- parameter: lst Initializer list that should be copy to the new array.
use vox_geometry_rust::array1::Array1; let arr = Array1::new_lst(vec![1.0, 2.0, 3.0, 4.0]); assert_eq!(4, arr.size()); for i in 0..4 { assert_eq!(i as f32 + 1.0, arr[i]); }
impl<T: ZeroInit> Array1<T>
[src]
impl<T: ZeroInit> Array1<T>
[src]pub fn set_scalar(&mut self, value: T)
[src]
pub fn set_scalar(&mut self, value: T)
[src]Sets entire array with given \p value.
use vox_geometry_rust::array1::Array1; let mut arr1 = Array1::new(12, Some(-1.0)); arr1.set_scalar(3.5); for a in arr1.iter() { assert_eq!(3.5, *a); }
pub fn set_self(&mut self, other: Array1<T>)
[src]
pub fn set_self(&mut self, other: Array1<T>)
[src]Copies given array \p other to this array.
use vox_geometry_rust::array1::Array1; let mut arr1 = Array1::new(12, Some(-1.0)); arr1.set_self(Array1::new_default()); assert_eq!(0, arr1.size());
pub fn set_lst(&mut self, lst: Vec<T>)
[src]
pub fn set_lst(&mut self, lst: Vec<T>)
[src]Copies given initializer list \p lst to this array.
use vox_geometry_rust::array1::Array1; let mut arr2 = Array1::new(12, Some(-1.0)); arr2.set_lst(vec![2.0, 5.0, 9.0, -1.0]); assert_eq!(4, arr2.size()); assert_eq!(2.0, arr2[0]); assert_eq!(5.0, arr2[1]); assert_eq!(9.0, arr2[2]); assert_eq!(-1.0, arr2[3]);
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
[src]Clears the array and resizes to zero.
use vox_geometry_rust::array1::Array1; let mut arr1 = Array1::new_lst(vec![2.0, 5.0, 9.0, -1.0]); arr1.clear(); assert_eq!(0, arr1.size());
pub fn resize(&mut self, size: usize, init_val: Option<T>)
[src]
pub fn resize(&mut self, size: usize, init_val: Option<T>)
[src]Resizes the array with \p size and fill the new element with \p initVal.
use vox_geometry_rust::array1::Array1; let mut arr:Array1<f32> = Array1::new_default(); arr.resize(9, None); assert_eq!(9, arr.size()); for i in 0..9 { assert_eq!(0.0, arr[i]); } arr.resize(12, Some(4.0)); assert_eq!(12, arr.size()); for i in 0..12 { if i < 9 { assert_eq!(0.0, arr[i]); } else { assert_eq!(4.0, arr[i]); } }
pub fn swap(&mut self, other: &mut Array1<T>)
[src]
pub fn swap(&mut self, other: &mut Array1<T>)
[src]Swaps the content of the array with \p other array.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Array1<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Array1<T> where
T: Send,
T: Send,
impl<T> Sync for Array1<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Array1<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Array1<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> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,