#[repr(transparent)]
pub struct Ptr<T> { /* fields omitted */ }
Expand description
This type is a thin wrapper around T to enable cheap clone and comparisons.
Internally it is an Arc that is compared by address instead of by the
implementation of the pointed to value.
Additionally, Ptr implements Error where T: Error. This makes working with
TryEventuals easier since many error types do not impl Value, but when
wrapped in Ptr do.
One thing to be aware of is that because values are compared by address
subscribers may be triggered unnecessarily in some contexts. If this is
undesirable use Arc instead.
This type is not specifically Eventual related, but is a useful pattern.
pub fn new(wrapped: T) -> Self
Immutably borrows from an owned value. Read more
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.
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
🔬 This is a nightly-only experimental API. (backtrace
)
Returns a stack backtrace, if available, of where this error occurred. Read more
👎 Deprecated since 1.42.0:
use the Display impl or to_string()
👎 Deprecated since 1.33.0:
replaced by Error::source, which can support downcasting
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
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
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
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
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.