#[repr(transparent)]
pub struct Array<'scope, 'data>(_, _, _);
Expand description

An n-dimensional Julia array.

Each element in the backing storage is either stored as a Value or inline. If the inline data is a bits union, the flag indicating the active variant is stored separately from the elements. You can check how the data is stored by calling Array::is_value_array, Array::is_inline_array, or Array::is_union_array.

Arrays that contain integers or floats are examples of inline arrays. Their data is stored as an array that contains numbers of the appropriate type, for example an array of Float32s in Julia is backed by an an array of f32s. The data in these arrays can be accessed with Array::inline_data and Array::inline_data_mut, and copied from Julia to Rust with Array::copy_inline_data. In order to call these methods the type of the elements must be provided, this type must implement ValidLayout to ensure the layouts in Rust and Julia are compatible.

If the data isn’t inlined each element is stored as a Value. This data can be accessed using Array::value_data and Array::value_data_mut.

Implementations

Allocate a new n-dimensional Julia array of dimensions dims for data of type T.

This method can only be used in combination with types that implement IntoJulia. If you want to create an array for a type that doesn’t implement this trait you must use Array::new_for.

If the array size is too large, Julia will throw an error. This error is caught and returned.

Allocate a new n-dimensional Julia array of dimensions dims for data of type T.

This method is equivalent to Array::new except that Julia exceptions are not caught.

Safety: If the array size is too large, Julia will throw an error. This error is not caught, which is UB from a ccalled function.

Allocate a new n-dimensional Julia array of dimensions dims for data of type ty.

The elementy type, ty must be a Union, UnionAllorDataType`.

If the array size is too large or if the type is invalid, Julia will throw an error. This error is caught and returned.

Allocate a new n-dimensional Julia array of dimensions dims for data of type T.

This method is equivalent to Array::new_for except that Julia exceptions are not caught.

Safety: If the array size is too large or if the type is invalid, Julia will throw an error. This error is not caught, which is UB from a ccalled function.

Create a new n-dimensional Julia array of dimensions dims that borrows data from Rust.

This method can only be used in combination with types that implement IntoJulia. Because the data is borrowed from Rust, operations that can change the size of the array (e.g. push!) will fail.

If the array size is too large, Julia will throw an error. This error is caught and returned.

Create a new n-dimensional Julia array of dimensions dims that borrows data from Rust.

This method can only be used in combination with types that implement IntoJulia. Because the data is borrowed from Rust, operations that can change the size of the array (e.g. push!) will fail.

Safety: If the array size is too large, Julia will throw an error. This error is not caught, which is UB from a ccalled function.

Create a new n-dimensional Julia array of dimensions dims that takes ownership of Rust data.

This method can only be used in combination with types that implement IntoJulia. Because the data is allocated by Rust, operations that can change the size of the array (e.g. push!) will fail.

If the array size is too large, Julia will throw an error. This error is caught and returned.

Create a new n-dimensional Julia array of dimensions dims that takes ownership of Rust data.

This method can only be used in combination with types that implement IntoJulia. Because the data is allocated by Rust, operations that can change the size of the array (e.g. push!) will fail.

Safety: If the array size is too large, Julia will throw an error. This error is not caught, which is UB from a ccalled function.

Convert a string to a Julia array.

Use the Output to extend the lifetime of this data.

Returns the array’s dimensions.

Returns the type of this array’s elements.

Returns the size of this array’s elements.

Returns true if the layout of the elements is compatible with T.

Returns true if the layout of the elements is compatible with T and these elements are stored inline.

Returns true if the elements of the array are stored inline.

Returns true if the elements of the array are stored inline and the element type is a union type.

Returns true if the elements of the array are stored inline and at least one of the fields of the inlined type is a pointer.

Returns true if elements of this array are zero-initialized.

Returns true if the elements of the array are stored as Values.

Convert this untyped array to a TypedArray.

Convert this untyped array to a TypedArray without checking if this conversion is valid.

Safety: T must be a valid representation of the data stored in the array.

Copy the data of an inline array to Rust.

Returns ArrayLayoutError::NotInline if the data is not stored inline or AccessError::InvalidLayout if the type of the elements is incorrect.

Immutably the contents of this array. The elements must have an isbits type.

You can borrow data from multiple arrays at the same time.

Returns ArrayLayoutError::NotInline if the data is not stored inline, ArrayLayoutError::NotBits if the type is not an isbits type, or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Mutably access the contents of this array. The elements must have an isbits type.

This method can be used to gain mutable access to the contents of a single array.

Returns ArrayLayoutError::NotInline if the data is not stored inline, ArrayLayoutError::NotBits if the type is not an isbits type, or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array. The elements must have an isbits type.

Unlike Array::bits_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Returns ArrayLayoutError::NotInline if the data is not stored inline, ArrayLayoutError::NotBits if the type is not an isbits type, or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Immutably the contents of this array. The elements must be stored inline.

You can borrow data from multiple arrays at the same time.

Returns ArrayLayoutError::NotInline if the data is not stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Mutably access the contents of this array. The elements must be stored inline.

This method can be used to gain mutable access to the contents of a single array.

Returns ArrayLayoutError::NotInline if the data is not stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array. The elements must be stored inline.

Unlike Array::inline_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Returns ArrayLayoutError::NotInline if the data is not stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Immutably the contents of this array. The elements must not be stored inline.

You can borrow data from multiple arrays at the same time.

Returns ArrayLayoutError::NotPointer if the data is stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Mutably access the contents of this array. The elements must not be stored inline.

This method can be used to gain mutable access to the contents of a single array.

Returns ArrayLayoutError::NotPointer if the data is stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array. The elements must not be stored inline.

Unlike Array::wrapper_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Returns ArrayLayoutError::NotPointer if the data is stored inline or AccessError::InvalidLayout if T is not a valid layout for the array elements.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Immutably the contents of this array. The elements must not be stored inline.

You can borrow data from multiple arrays at the same time.

Returns ArrayLayoutError::NotPointer if the data is stored inline.

Mutably access the contents of this array. The elements must not be stored inline.

This method can be used to gain mutable access to the contents of a single array.

Returns ArrayLayoutError::NotPointer if the data is stored inline.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array. The elements must not be stored inline.

Unlike Array::value_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Returns ArrayLayoutError::NotPointer if the data is stored inline.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Immutably access the contents of this array. The element type must be a bits union type.

You can borrow data from multiple arrays at the same time.

Returns ArrayLayoutError::NotUnion if the data is not stored as a bits union.

Mutably access the contents of this array. The element type must be a bits union.

This method can be used to gain mutable access to the contents of a single array.

Returns ArrayLayoutError::NotUnion if the data is not stored as a bits union.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array. The element type must be a bits union.

Unlike Array::union_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Returns ArrayLayoutError::NotUnion if the data is not stored as a bits union.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Immutably access the contents of this array.

You can borrow data from multiple arrays at the same time.

Mutably access the contents of this array.

This method can be used to gain mutable access to the contents of a single array.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed.

Mutably access the contents of this array.

Unlike Array::indeterminate_data_mut, this method can be used to gain mutable access to the contents of multiple arrays simultaneously.

Safety: Mutating Julia data is generally unsafe because it can’t be guaranteed mutating this value is allowed. This method can create multiple mutable references to the same data.

Reshape the array, a new array is returned that has dimensions dims. The new array and self share their data.

This method returns an exception if the old and new array have a different number of elements.

Reshape the array, a new array is returned that has dimensions dims. The new array and self share their data.

Safety: If the dimensions are incompatible with the array size, Julia will throw an error. This error is not caught, which is UB from a ccalled function.

Insert inc elements at the end of the array.

The array must be 1D and not contain data borrowed or moved from Rust, otherwise an exception is returned.

Insert inc elements at the end of the array.

Safety: the array must be 1D and not contain data borrowed or moved from Rust, otherwise Julia throws an exception. This error is not exception, which is UB from a ccalled function.

Remove dec elements from the end of the array.

The array must be 1D, not contain data borrowed or moved from Rust, otherwise an exception is returned.

Remove dec elements from the end of the array.

Safety: the array must be 1D and not contain data borrowed or moved from Rust, otherwise Julia throws an exception. This error is not exception, which is UB from a ccalled function.

Insert inc elements at the beginning of the array.

The array must be 1D, not contain data borrowed or moved from Rust, otherwise an exception is returned.

Insert inc elements at the beginning of the array.

Safety: the array must be 1D and not contain data borrowed or moved from Rust, otherwise Julia throws an exception. This error is not exception, which is UB from a ccalled function.

Remove dec elements from the beginning of the array.

The array must be 1D, not contain data borrowed or moved from Rust, otherwise an exception is returned.

Remove dec elements from the beginning of the array.

Safety: the array must be 1D and not contain data borrowed or moved from Rust, otherwise Julia throws an exception. This error is not exception, which is UB from a ccalled function.

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

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 the argument unchanged.

Calls U::from(self).

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

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

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.

Convert the wrapper to a Ref.

Convert the wrapper to a Value.

Convert the wrapper to its display string, i.e. the string that is shown when calling Base.show. Read more

Convert the wrapper to its error string, i.e. the string that is shown when calling Base.showerror. This string can contain ANSI color codes if this is enabled by calling Julia::error_color, AsyncJulia::error_color, or AsyncJulia::try_error_color, . Read more

Convert the wrapper to its display string, i.e. the string that is shown by calling Base.display, or some default value. Read more

Convert the wrapper to its error string, i.e. the string that is shown when this value is thrown as an exception, or some default value. Read more