Struct jlrs::data::managed::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§

source§

impl<'data> Array<'_, 'data>

source

pub fn new<'target, 'current, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, dims: D ) -> ArrayResult<'target, 'static, S>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub unsafe fn new_unchecked<'target, 'current, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, dims: D ) -> ArrayData<'target, 'static, S>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub fn new_for<'target, 'current, 'borrow, D, S>( target: ExtendedTarget<'target, '_, '_, S>, dims: D, ty: Value<'_, '_> ) -> ArrayResult<'target, 'static, S>where D: Dims, S: Target<'target>,

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.

source

pub unsafe fn new_for_unchecked<'target, 'current, 'borrow, D, S>( target: ExtendedTarget<'target, '_, '_, S>, dims: D, ty: Value<'_, '_> ) -> ArrayData<'target, 'static, S>where D: Dims, S: Target<'target>,

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.

source

pub fn from_slice<'target: 'current, 'current: 'borrow, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, data: &'data mut [T], dims: D ) -> JlrsResult<ArrayResult<'target, 'data, S>>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub unsafe fn from_slice_unchecked<'target, 'current, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, data: &'data mut [T], dims: D ) -> JlrsResult<ArrayData<'target, 'data, S>>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub fn from_vec<'target, 'current, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, data: Vec<T>, dims: D ) -> JlrsResult<ArrayResult<'target, 'static, S>>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub unsafe fn from_vec_unchecked<'target, 'current, 'borrow, T, D, S>( target: ExtendedTarget<'target, '_, '_, S>, data: Vec<T>, dims: D ) -> JlrsResult<ArrayData<'target, 'static, S>>where T: IntoJulia, D: Dims, S: Target<'target>,

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.

source

pub fn from_string<'target, A, T>( target: T, data: A ) -> ArrayData<'target, 'static, T>where A: AsRef<str>, T: Target<'target>,

Convert a string to a Julia array.

source§

impl<'scope, 'data> Array<'scope, 'data>

source

pub unsafe fn dimensions(self) -> ArrayDimensions<'scope>

Returns the array’s dimensions. TODO safety

source

pub fn element_type(self) -> Value<'scope, 'static>

Returns the type of this array’s elements.

source

pub fn element_size(self) -> usize

Returns the size of this array’s elements.

source

pub fn contains<T: ValidField>(self) -> bool

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

source

pub fn contains_inline<T: ValidField>(self) -> bool

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

source

pub fn is_inline_array(self) -> bool

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

source

pub fn is_union_array(self) -> bool

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

source

pub fn has_inlined_pointers(self) -> bool

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.

source

pub fn zero_init(self) -> bool

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

source

pub fn is_value_array(self) -> bool

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

source

pub fn try_as_typed<T>(self) -> JlrsResult<TypedArray<'scope, 'data, T>>where T: ValidField,

Convert this untyped array to a TypedArray.

source

pub fn as_typed_value<T: ConstructType, const N: isize>( self, frame: &mut GcFrame<'_> ) -> JlrsResult<TypedValue<'scope, 'data, ArrayType<T, N>>>

Convert this array to a TypedValue.

source

pub unsafe fn as_typed_value_unchecked<T: ConstructType, const N: isize>( self ) -> TypedValue<'scope, 'data, ArrayType<T, N>>

Convert this array to a TypedValue without checking if the layout is compatible.

source

pub fn try_as_ranked<const N: isize>( self ) -> JlrsResult<RankedArray<'scope, 'data, N>>

Convert this array to a RankedArray.

source

pub fn try_as_typed_ranked<U: ValidField, const N: isize>( self ) -> JlrsResult<TypedRankedArray<'scope, 'data, U, N>>

Convert this array to a TypedRankedArray.

source

pub unsafe fn as_typed_unchecked<T>(self) -> TypedArray<'scope, 'data, T>where T: ValidField,

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.

source

pub fn track_shared<'borrow>( &'borrow self ) -> JlrsResult<TrackedArray<'borrow, 'scope, 'data, Self>>

Track this array.

While an array is tracked, it can’t be exclusively tracked.

source

pub unsafe fn track_exclusive<'borrow>( &'borrow mut self ) -> JlrsResult<TrackedArrayMut<'borrow, 'scope, 'data, Self>>

Exclusively track this array.

While an array is exclusively tracked, it can’t be tracked otherwise.

source

pub unsafe fn copy_inline_data<T>(&self) -> JlrsResult<CopiedArray<T>>where T: 'static + ValidField + Unbox,

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.

source

pub unsafe fn bits_data<'borrow, T>( &'borrow self ) -> JlrsResult<BitsArrayAccessorI<'borrow, 'scope, 'data, T>>where T: ValidField,

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

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: it’s not checked if the content of this array are already borrowed by Rust code.

source

pub unsafe fn bits_data_mut<'borrow, T>( &'borrow mut self ) -> JlrsResult<BitsArrayAccessorMut<'borrow, 'scope, 'data, T>>where T: ValidField,

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

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.

source

pub unsafe fn inline_data<'borrow, T>( &'borrow self ) -> JlrsResult<InlinePtrArrayAccessorI<'borrow, 'scope, 'data, T>>where T: ValidField,

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.

source

pub unsafe fn inline_data_mut<'borrow, T>( &'borrow mut self ) -> JlrsResult<InlinePtrArrayAccessorMut<'borrow, 'scope, 'data, T>>where T: ValidField,

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.

source

pub unsafe fn managed_data<'borrow, T>( &'borrow self ) -> JlrsResult<PtrArrayAccessorI<'borrow, 'scope, 'data, T>>where T: ManagedRef<'scope, 'data>, Option<T>: ValidField,

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.

source

pub unsafe fn managed_data_mut<'borrow, T>( &'borrow mut self ) -> JlrsResult<PtrArrayAccessorMut<'borrow, 'scope, 'data, T>>where T: ManagedRef<'scope, 'data>, Option<T>: ValidField,

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.

source

pub unsafe fn value_data<'borrow>( &'borrow self ) -> JlrsResult<PtrArrayAccessorI<'borrow, 'scope, 'data, ValueRef<'scope, '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.

source

pub unsafe fn value_data_mut<'borrow>( &'borrow mut self ) -> JlrsResult<PtrArrayAccessorMut<'borrow, 'scope, 'data, ValueRef<'scope, 'data>>>

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.

source

pub unsafe fn union_data<'borrow>( &'borrow self ) -> JlrsResult<UnionArrayAccessorI<'borrow, 'scope, '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.

source

pub unsafe fn union_data_mut<'borrow>( &'borrow mut self ) -> JlrsResult<UnionArrayAccessorMut<'borrow, 'scope, 'data>>

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.

source

pub unsafe fn indeterminate_data<'borrow>( &'borrow self ) -> IndeterminateArrayAccessorI<'borrow, 'scope, 'data>

Immutably access the contents of this array.

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

source

pub unsafe fn indeterminate_data_mut<'borrow>( &'borrow mut self ) -> IndeterminateArrayAccessor<'borrow, 'scope, 'data, Mutable<'borrow, u8>>

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.

source

pub unsafe fn into_slice_unchecked<T>(self) -> &'scope [T]

source

pub unsafe fn as_slice_unchecked<'borrow, T>(&'borrow self) -> &'borrow [T]

source

pub unsafe fn into_mut_slice_unchecked<T>(self) -> &'scope mut [T]

source

pub unsafe fn as_mut_slice_unchecked<'borrow, T>( &'borrow mut self ) -> &'borrow mut [T]

source

pub unsafe fn reshape<'target, 'current, 'borrow, D, S>( &self, target: ExtendedTarget<'target, '_, '_, S>, dims: D ) -> ArrayResult<'target, 'data, S>where D: Dims, S: Target<'target>,

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.

source

pub unsafe fn reshape_unchecked<'target, 'current, 'borrow, D, S>( &self, target: ExtendedTarget<'target, '_, '_, S>, dims: D ) -> ArrayData<'target, 'data, S>where D: Dims, S: Target<'target>,

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.

source§

impl<'scope> Array<'scope, 'static>

source

pub unsafe fn grow_end<'target, S>( &mut self, target: S, inc: usize ) -> S::Exception<'static, ()>where S: Target<'target>,

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.

source

pub unsafe fn grow_end_unchecked(&mut self, inc: usize)

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.

source

pub unsafe fn del_end<'target, S>( &mut self, target: S, dec: usize ) -> S::Exception<'static, ()>where S: Target<'target>,

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.

source

pub unsafe fn del_end_unchecked(&mut self, dec: usize)

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.

source

pub unsafe fn grow_begin<'target, S>( &mut self, target: S, inc: usize ) -> S::Exception<'static, ()>where S: Target<'target>,

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.

source

pub unsafe fn grow_begin_unchecked(&mut self, inc: usize)

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.

source

pub unsafe fn del_begin<'target, S>( &mut self, target: S, dec: usize ) -> S::Exception<'static, ()>where S: Target<'target>,

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.

source

pub unsafe fn del_begin_unchecked(&mut self, dec: usize)

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.

source§

impl Array<'static, 'static>

source

pub fn track_shared_unbound( self ) -> JlrsResult<TrackedArray<'static, 'static, 'static, Self>>

Track this array.

While an array is tracked, it can’t be exclusively tracked.

source

pub unsafe fn track_exclusive_unbound( self ) -> JlrsResult<TrackedArrayMut<'static, 'static, 'static, Self>>

Exclusively track this array.

While an array is exclusively tracked, it can’t be tracked otherwise.

Trait Implementations§

source§

impl<'scope, 'data> CCallArg for Array<'scope, 'data>

§

type CCallArgType = Value<'static, 'static>

§

type FunctionArgType = Array<'scope, 'data>

source§

impl<'scope, 'data> Clone for Array<'scope, 'data>

source§

fn clone(&self) -> Array<'scope, 'data>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl ConstructType for Array<'_, '_>

source§

fn construct_type<'target, T>( target: ExtendedTarget<'target, '_, '_, T> ) -> ValueData<'target, 'static, T>where T: Target<'target>,

Constructs the type object associated with this type.
source§

fn base_type<'target, Tgt>(target: &Tgt) -> Option<Value<'target, 'static>>where Tgt: Target<'target>,

Returns the base type object associated with this type. Read more
source§

fn is_compatible<T>(frame: &mut GcFrame<'_>) -> boolwhere T: ValidField,

Returns true if T is a valid field layout for instances of the constructed type.
source§

impl Debug for Array<'_, '_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'scope, 'data> Typecheck for Array<'scope, 'data>

source§

fn typecheck(t: DataType<'_>) -> bool

Returns whether the property implied by Self holds true.
source§

impl<'scope, 'data> Copy for Array<'scope, 'data>

Auto Trait Implementations§

§

impl<'scope, 'data> RefUnwindSafe for Array<'scope, 'data>

§

impl<'scope, 'data> !Send for Array<'scope, 'data>

§

impl<'scope, 'data> !Sync for Array<'scope, 'data>

§

impl<'scope, 'data> Unpin for Array<'scope, 'data>

§

impl<'scope, 'data> !UnwindSafe for Array<'scope, 'data>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> Twhere Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<'scope, 'data, W> Managed<'scope, 'data> for Wwhere W: ManagedPriv<'scope, 'data>,

§

type TypeConstructor = <W as ManagedPriv<'scope, 'data>>::TypeConstructorPriv<'target, 'da>

Self, but with arbitrary lifetimes. Used to construct the appropriate type in generic contexts.
source§

fn as_ref(self) -> Ref<'scope, 'data, Self>

Convert the data to a Ref.
source§

fn as_value(self) -> Value<'scope, 'data>

Convert the data to a Value.
source§

fn root<'target, T>( self, target: T ) -> T::Data<'data, Self::TypeConstructor<'target, 'data>>where T: Target<'target>,

Use the target to reroot this data.
source§

fn unrooted_target(self) -> Unrooted<'scope>

Returns a new Unrooted.
source§

fn display_string(self) -> JlrsResult<String>

Convert the data to its display string, i.e. the string that is shown when calling Base.show.
source§

fn error_string(self) -> JlrsResult<String>

Convert the data 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 or AsyncJulia::error_color.
source§

fn display_string_or<S: Into<String>>(self, default: S) -> String

Convert the data to its display string, i.e. the string that is shown by calling Base.display, or some default value.
source§

fn error_string_or<S: Into<String>>(self, default: S) -> String

Convert the data to its error string, i.e. the string that is shown when this value is thrown as an exception, or some default value.
source§

fn leak(self) -> Ref<'static, 'data, Self::TypeConstructor<'static, 'data>>

Extends the 'scope lifetime to 'static, which allows this managed data to be leaked from a scope. Read more
§

impl<T> Pipe for Twhere T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> Rwhere Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R ) -> Rwhere Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Selfwhere Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.