Struct postgres_array::array::Array [] [src]

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

A multi-dimensional array.

Methods

impl<T> Array<T>
[src]

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: i32) -> Array<T>

Creates a new one-dimensional array.

fn wrap(&mut self, lower_bound: i32)

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.

fn into_inner(self) -> Vec<T>

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]

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

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl<T: Eq> Eq for Array<T>
[src]

impl<T: PartialEq> PartialEq for Array<T>
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

impl<T: Debug> Debug for Array<T>
[src]

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

Formats the value using the given formatter.

impl<T: Display> Display for Array<T>
[src]

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

Formats the value using the given formatter.

impl<T, I: ArrayIndex> Index<I> for Array<T>
[src]

Indexes into the Array, retrieving a reference to the contained value.

Since Arrays 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)]);

type Output = T

The returned type after indexing

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

The method for the indexing (Foo[Bar]) operation

impl<T, I: ArrayIndex> IndexMut<I> for Array<T>
[src]

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

The method for the indexing (Foo[Bar]) operation

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?

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

Creates an iterator from a value. Read more

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?

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

Creates an iterator from a value. Read more

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?

fn into_iter(self) -> IntoIter<T>

Creates an iterator from a value. Read more

impl<T> FromSql for Array<T> where T: FromSql
[src]

fn from_sql(ty: &Type, raw: &[u8], info: &SessionInfo) -> Result<Array<T>, Box<Error + Sync + Send>>

Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be created from the specified Postgres Type. Read more

fn from_sql_null(ty: &Type, ctx: &SessionInfo) -> Result<Self, Box<Error + 'static + Send + Sync>>

Creates a new value of this type from a NULL SQL value. Read more

fn from_sql_nullable(ty: &Type, raw: Option<&[u8]>, ctx: &SessionInfo) -> Result<Self, Box<Error + 'static + Send + Sync>>

A convenience function that delegates to from_sql and from_sql_null depending on the value of raw. Read more

impl<T> ToSql for Array<T> where T: ToSql
[src]

fn to_sql(&self, ty: &Type, w: &mut Vec<u8>, info: &SessionInfo) -> Result<IsNullBox<Error + Sync + Send>>

Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more

fn accepts(ty: &Type) -> bool

Determines if a value of this type can be converted to the specified Postgres Type. Read more

fn to_sql_checked(&self, ty: &Type, out: &mut Vec<u8>, ctx: &SessionInfo) -> Result<IsNullBox<Error + Sync + Send>>

An adaptor method used internally by Rust-Postgres. Read more

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy