Struct tiptoe::Arc[][src]

#[repr(transparent)]
pub struct Arc<T: ?Sized + IntrusivelyCountable> { /* fields omitted */ }
Expand description

An asynchronously reference-counted smart pointer (copy-on-write single-item container).

Unlike with alloc::sync::Arc, the reference-count must be embedded in the payload instance itself.

Implementations

Creates a new instance of Arc<_> by moving value into a new heap allocation.

This increases the intrusive reference-count by 1.

Calling this method with an instance with non-zero reference-count is safe, but likely to lead to memory leaks (or the process being aborted, if the recorded count is very high).

Creates a new instance of Pin<Arc<_>> by moving value into a new heap allocation.

This increases the intrusive reference-count by 1.

Calling this method with an instance with non-zero reference-count is safe, but likely to lead to memory leaks (or the process being aborted, if the recorded count is very high).

Errors

Iff this Arc is not an exclusive handle.

Errors

Iff this Arc is not an exclusive handle.

Constructs an Arc instance from a compatible value pointer.

Safety

The pointer raw_value must have been created by leaking the heap-allocated value in a compatible unpinned container.

Containers are incompatible if their type parameter differs in a way that makes the equivalent pointer reinterpretation cast invalid. Otherwise:

(Arc and Rc are compatible. Box is compatible iff the internal reference count had been incremented to at least 1 at the time of leaking.)

For every time the instance that pointer points to was leaked, this function must be called at most once.

The data raw_value points to may be in use only by Arc.

Constructs a pinned Arc instance from a compatible value pointer.

Safety

The pointer raw_value must have been created by leaking the heap-allocated value in a compatible container.

Containers are incompatible if their type parameter differs in a way that makes the equivalent pointer reinterpretation cast invalid. Otherwise:

(Arc and Rc are compatible. Box is compatible iff the internal reference count had been incremented to at least 1 at the time of leaking.)

For every time the instance that pointer points to was leaked, this function must be called at most once.

The data raw_value points to may be in use only by Arc.

Unsafely borrows a shared reference to an Arc-managed instance as Arc.

This is purely a reinterpretation cast.

Safety

inner must be a reference to a reference to an instance managed by Arc.

Unsafely borrows a shared reference to a Pin<Arc>-managed instance as Pin<Arc>.

This is purely a reinterpretation cast.

Safety

inner must be a reference to a reference to an instance managed by Pin<Arc>.

Unwraps the payload pointer contained in the current instance.

This does not decrease the reference-count.

Unwraps the payload pointer contained in the current instance.

This does not decrease the reference-count.

Safety Notes

Keep in mind that the pinning invariants, including the drop guarantee, must still be upheld.

Checks whether two instances of Arc<T> point to the same instance.

Ensures the payload is exclusively pointed to by this Arc<T>, cloning it if necessary, and gives access to a Pin<&mut T> that safely can not be used to clone the Arc<T>.

Checks whether the payload is exclusively pointed to by this Arc<T> and, if this is the case, gives access to a Pin<&mut T> that safely can not be used to clone the Arc<T>.

Attempts to cast this Arc into once of concrete type U.

Errors

Iff the underlying instance isn’t a U.

Attempts to cast this Arc into once of concrete type U.

Errors

Iff the underlying instance isn’t a U.

Trait Implementations

Performs the conversion.

Immutably borrows from an owned value. Read more

Makes a clone of this Arc, pointing to the same instance.

This increases the strong reference count by 1.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Performs the conversion.

Converts a Box into an Arc without reallocating.

Always converts into an exclusive instance, either by copying or by moving the value.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Formats the value using the given formatter.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Safety Read more

Safety Read more

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. 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.