Struct postgres_array::Array [] [src]

pub struct Array<T> {
    // some fields omitted
}

A multi-dimensional array.

Methods

impl<T> Array<T>

fn from_parts(data: Vec<T>, dimensions: Vec<Dimension>) -> Array<T>

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.

fn from_vec(data: Vec<T>, lower_bound: isize) -> Array<T>

Creates a new one-dimensional array.

fn wrap(&mut self, lower_bound: isize)

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]].

fn push(&mut self, other: Array<T>)

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.

fn dimensions(&self) -> &[Dimension]

Returns the dimensions of this array.

fn iter<'a>(&'a self) -> Iter<'a, T>

Returns an iterator over references to the elements of the array in the higher-dimensional equivalent of row-major order.

fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T>

Returns an iterator over mutable references to the elements of the array in the higher-dimensional equivalent of row-major order.

Trait Implementations

impl<T: Debug> Debug for Array<T>

fn fmt(&self, fmt: &mut Formatter) -> Result

impl<T, I: ArrayIndex> Index<I> for Array<T>

type Output = T

fn index(&self, idx: I) -> &T

impl<T, I: ArrayIndex> IndexMut<I> for Array<T>

fn index_mut(&mut self, idx: I) -> &mut T

impl<'a, T: 'a> IntoIterator for &'a Array<T>

type Item = &'a T

type IntoIter = Iter<'a, T>

fn into_iter(self) -> Iter<'a, T>

impl<'a, T: 'a> IntoIterator for &'a mut Array<T>

type Item = &'a mut T

type IntoIter = IterMut<'a, T>

fn into_iter(self) -> IterMut<'a, T>

impl<T> IntoIterator for Array<T>

type Item = T

type IntoIter = IntoIter<T>

fn into_iter(self) -> IntoIter<T>

impl<T> FromSql for Array<Option<T>> where T: FromSql

fn from_sql<R: Read>(ty: &Type, raw: &mut R, info: &SessionInfo) -> Result<Array<Option<T>>>

fn accepts(ty: &Type) -> bool

fn from_sql_nullable<R>(ty: &Type, raw: Option<&mut R>, ctx: &SessionInfo) -> Result<Self, Error> where R: Read

impl<T> ToSql for Array<T> where T: ToSql

fn to_sql<W: ?Sized + Write>(&self, ty: &Type, w: &mut W, info: &SessionInfo) -> Result<IsNull>

fn accepts(ty: &Type) -> bool

fn to_sql_checked(&self, ty: &Type, out: &mut Write, ctx: &SessionInfo) -> Result<IsNull>

Derived Implementations

impl<T: Clone> Clone for Array<T>

fn clone(&self) -> Array<T>

fn clone_from(&mut self, source: &Self)

impl<T: Eq> Eq for Array<T>

impl<T: PartialEq> PartialEq for Array<T>

fn eq(&self, __arg_0: &Array<T>) -> bool

fn ne(&self, __arg_0: &Array<T>) -> bool