Struct jlrs::wrappers::ptr::array::Array

source ·
#[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 ValidField to ensure the layouts in Rust and Julia are compatible.

If the data isn’t inlined, e.g. because it’s mutable, 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.

Returns the array’s dimensions. TODO safety

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.

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.

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.

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.

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.

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.

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.

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
Returns whether the property implied by Self holds true.

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
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted.
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted.
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. 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.

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
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
Attempts to convert self into T using TryInto<T>. 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.
Self, but with arbitrary lifetimes. Used to construct the appropriate type in generic contexts. Read more
Convert the wrapper to a Ref.
Convert the wrapper to a Value.
Use the target to reroot this data.
Returns a new Unrooted.
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