pub struct Array<T> { /* private fields */ }
Expand description

A multi-dimensional array.

Implementations

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.

Creates a new one-dimensional array.

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

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.

Returns the dimensions of this array.

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

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

Returns the underlying data vector for this Array in the higher-dimensional equivalent of row-major order.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Creates a new value of this type from a buffer of data of the specified Postgres Type in its binary format. Read more
Determines if a value of this type can be created from the specified Postgres Type. Read more
Creates a new value of this type from a NULL SQL value. Read more
A convenience function that delegates to from_sql and from_sql_null depending on the value of raw. Read more

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)]);
The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
Performs the mutable indexing (container[index]) operation. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Converts the value of self into the binary format of the specified Postgres Type, appending it to out. Read more
Determines if a value of this type can be converted to the specified Postgres Type. Read more
An adaptor method used internally by Rust-Postgres. Read more
Specify the encode format

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Returns a reference to self as a ToSql trait object.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.