[−][src]Struct postgres_array::Array
A multi-dimensional array.
Implementations
impl<T> Array<T>
[src]
pub fn from_parts(data: Vec<T>, dimensions: Vec<Dimension>) -> Array<T>
[src]
Creates a new Array
from its underlying components.
The data array should be provided in the higher-dimensional equivalent of row-major order.
Panics
Panics if the number of elements provided does not match the number of elements specified by the dimensions.
pub fn from_vec(data: Vec<T>, lower_bound: i32) -> Array<T>
[src]
Creates a new one-dimensional array.
pub fn wrap(&mut self, lower_bound: i32)
[src]
Wraps this array in a new dimension of size 1.
For example, the one dimensional array [1, 2]
would turn into the
two-dimensional array [[1, 2]]
.
pub fn push(&mut self, other: Array<T>)
[src]
Consumes another array, appending it to the top level dimension of this array.
The dimensions of the other array must be the same as the dimensions of this array with the first dimension removed. This includes lower bounds as well as lengths.
For example, if [3, 4]
is pushed onto [[1, 2]]
, the result is
[[1, 2], [3, 4]]
.
Panics
Panics if the dimensions of the two arrays do not match.
pub fn dimensions(&self) -> &[Dimension]
[src]
Returns the dimensions of this array.
pub fn iter(&self) -> Iter<'_, T>ⓘ
[src]
Returns an iterator over references to the elements of the array in the higher-dimensional equivalent of row-major order.
pub fn iter_mut(&mut self) -> IterMut<'_, T>ⓘ
[src]
Returns an iterator over mutable references to the elements of the array in the higher-dimensional equivalent of row-major order.
pub fn into_inner(self) -> Vec<T>
[src]
Returns the underlying data vector for this Array in the higher-dimensional equivalent of row-major order.
Trait Implementations
impl<T: Clone> Clone for Array<T>
[src]
impl<T: Debug> Debug for Array<T>
[src]
impl<T: Display> Display for Array<T>
[src]
impl<T: Eq> Eq for Array<T>
[src]
impl<'de, T> FromSql<'de> for Array<T> where
T: FromSql<'de>,
[src]
T: FromSql<'de>,
pub fn from_sql(
ty: &Type,
raw: &'de [u8]
) -> Result<Array<T>, Box<dyn Error + Sync + Send>>
[src]
ty: &Type,
raw: &'de [u8]
) -> Result<Array<T>, Box<dyn Error + Sync + Send>>
pub fn accepts(ty: &Type) -> bool
[src]
pub fn from_sql_null(
ty: &Type
) -> Result<Self, Box<dyn Error + 'static + Send + Sync, Global>>
[src]
ty: &Type
) -> Result<Self, Box<dyn Error + 'static + Send + Sync, Global>>
pub fn from_sql_nullable(
ty: &Type,
raw: Option<&'a [u8]>
) -> Result<Self, Box<dyn Error + 'static + Send + Sync, Global>>
[src]
ty: &Type,
raw: Option<&'a [u8]>
) -> Result<Self, Box<dyn Error + 'static + Send + Sync, Global>>
impl<T, I: ArrayIndex> Index<I> for Array<T>
[src]
Indexes into the Array
, retrieving a reference to the contained
value.
Since Array
s can be multi-dimensional, the Index
trait is
implemented for a variety of index types. In the most generic case, a
&[i32]
can be used. In addition, a bare i32
as well as tuples
of up to 10 i32
values may be used for convenience.
Panics
Panics if the index does not correspond to an in-bounds element of the
Array
.
Examples
let mut array = Array::from_vec(vec![0i32, 1, 2, 3], 0); assert_eq!(2, array[2]); array.wrap(0); array.push(Array::from_vec(vec![4, 5, 6, 7], 0)); assert_eq!(6, array[(1, 2)]);
impl<T, I: ArrayIndex> IndexMut<I> for Array<T>
[src]
impl<'a, T: 'a> IntoIterator for &'a Array<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Iter<'a, T>ⓘ
[src]
impl<'a, T: 'a> IntoIterator for &'a mut Array<T>
[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = IterMut<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> IterMut<'a, T>ⓘ
[src]
impl<T> IntoIterator for Array<T>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> IntoIter<T>ⓘ
[src]
impl<T: PartialEq> PartialEq<Array<T>> for Array<T>
[src]
impl<T> StructuralEq for Array<T>
[src]
impl<T> StructuralPartialEq for Array<T>
[src]
impl<T> ToSql for Array<T> where
T: ToSql,
[src]
T: ToSql,
Auto Trait Implementations
impl<T> RefUnwindSafe for Array<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Array<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Array<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Array<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Array<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> BorrowToSql for T where
T: ToSql,
[src]
T: ToSql,
pub fn borrow_to_sql(&self) -> &dyn ToSql
[src]
impl<T> From<T> for T
[src]
impl<T> FromSqlOwned for T where
T: for<'a> FromSql<'a>,
[src]
T: for<'a> FromSql<'a>,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,