rerun::external::parking_lot::lock_api

Struct RwLock

pub struct RwLock<R, T>
where T: ?Sized,
{ raw: R, data: UnsafeCell<T>, }
Expand description

A reader-writer lock

This type of lock allows a number of readers or at most one writer at any point in time. The write portion of this lock typically allows modification of the underlying data (exclusive access) and the read portion of this lock typically allows for read-only access (shared access).

The type parameter T represents the data that this lock protects. It is required that T satisfies Send to be shared across threads and Sync to allow concurrent access through readers. The RAII guards returned from the locking methods implement Deref (and DerefMut for the write methods) to allow access to the contained of the lock.

Fields§

§raw: R§data: UnsafeCell<T>

Implementations§

§

impl<R, T> RwLock<R, T>
where R: RawRwLock,

pub const fn new(val: T) -> RwLock<R, T>

Creates a new instance of an RwLock<T> which is unlocked.

pub fn into_inner(self) -> T

Consumes this RwLock, returning the underlying data.

§

impl<R, T> RwLock<R, T>

pub const fn from_raw(raw_rwlock: R, val: T) -> RwLock<R, T>

Creates a new new instance of an RwLock<T> based on a pre-existing RawRwLock<T>.

pub const fn const_new(raw_rwlock: R, val: T) -> RwLock<R, T>

Creates a new new instance of an RwLock<T> based on a pre-existing RawRwLock<T>.

This allows creating a RwLock<T> in a constant context on stable Rust.

This method is a legacy alias for from_raw.

§

impl<R, T> RwLock<R, T>
where R: RawRwLock, T: ?Sized,

pub unsafe fn make_read_guard_unchecked(&self) -> RwLockReadGuard<'_, R, T>

Creates a new RwLockReadGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds a read lock.

This function does not increment the read count of the lock. Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.

pub unsafe fn make_write_guard_unchecked(&self) -> RwLockWriteGuard<'_, R, T>

Creates a new RwLockReadGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds a write lock.

Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.

pub fn read(&self) -> RwLockReadGuard<'_, R, T>

Locks this RwLock with shared read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers which hold the lock. There may be other readers currently inside the lock when this method returns.

Note that attempts to recursively acquire a read lock on a RwLock when the current thread already holds one may result in a deadlock.

Returns an RAII guard which will release this thread’s shared access once it is dropped.

pub fn try_read(&self) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access.

If the access could not be granted at this time, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

This function does not block.

pub fn write(&self) -> RwLockWriteGuard<'_, R, T>

Locks this RwLock with exclusive write access, blocking the current thread until it can be acquired.

This function will not return while other writers or other readers currently have access to the lock.

Returns an RAII guard which will drop the write access of this RwLock when dropped.

pub fn try_write(&self) -> Option<RwLockWriteGuard<'_, R, T>>

Attempts to lock this RwLock with exclusive write access.

If the lock could not be acquired at this time, then None is returned. Otherwise, an RAII guard is returned which will release the lock when it is dropped.

This function does not block.

pub fn get_mut(&mut self) -> &mut T

Returns a mutable reference to the underlying data.

Since this call borrows the RwLock mutably, no actual locking needs to take place—the mutable borrow statically guarantees no locks exist.

pub fn is_locked(&self) -> bool

Checks whether this RwLock is currently locked in any way.

pub fn is_locked_exclusive(&self) -> bool

Check if this RwLock is currently exclusively locked.

pub unsafe fn force_unlock_read(&self)

Forcibly unlocks a read lock.

This is useful when combined with mem::forget to hold a lock without the need to maintain a RwLockReadGuard object alive, for example when dealing with FFI.

§Safety

This method must only be called if the current thread logically owns a RwLockReadGuard but that guard has be discarded using mem::forget. Behavior is undefined if a rwlock is read-unlocked when not read-locked.

pub unsafe fn force_unlock_write(&self)

Forcibly unlocks a write lock.

This is useful when combined with mem::forget to hold a lock without the need to maintain a RwLockWriteGuard object alive, for example when dealing with FFI.

§Safety

This method must only be called if the current thread logically owns a RwLockWriteGuard but that guard has be discarded using mem::forget. Behavior is undefined if a rwlock is write-unlocked when not write-locked.

pub unsafe fn raw(&self) -> &R

Returns the underlying raw reader-writer lock object.

Note that you will most likely need to import the RawRwLock trait from lock_api to be able to call functions on the raw reader-writer lock.

§Safety

This method is unsafe because it allows unlocking a mutex while still holding a reference to a lock guard.

pub fn data_ptr(&self) -> *mut T

Returns a raw pointer to the underlying data.

This is useful when combined with mem::forget to hold a lock without the need to maintain a RwLockReadGuard or RwLockWriteGuard object alive, for example when dealing with FFI.

§Safety

You must ensure that there are no data races when dereferencing the returned pointer, for example if the current thread logically owns a RwLockReadGuard or RwLockWriteGuard but that guard has been discarded using mem::forget.

pub unsafe fn make_arc_read_guard_unchecked( self: &Arc<RwLock<R, T>>, ) -> ArcRwLockReadGuard<R, T>

Creates a new RwLockReadGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds a read lock.

This function does not increment the read count of the lock. Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.`

pub unsafe fn make_arc_write_guard_unchecked( self: &Arc<RwLock<R, T>>, ) -> ArcRwLockWriteGuard<R, T>

Creates a new RwLockWriteGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds a write lock.

Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.

pub fn read_arc(self: &Arc<RwLock<R, T>>) -> ArcRwLockReadGuard<R, T>

Locks this RwLock with read access, through an Arc.

This method is similar to the read method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_read_arc( self: &Arc<RwLock<R, T>>, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to lock this RwLock with read access, through an Arc.

This method is similar to the try_read method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn write_arc(self: &Arc<RwLock<R, T>>) -> ArcRwLockWriteGuard<R, T>

Locks this RwLock with write access, through an Arc.

This method is similar to the write method; however, it requires the RwLock to be inside of an Arc and the resulting write guard has no lifetime requirements.

pub fn try_write_arc( self: &Arc<RwLock<R, T>>, ) -> Option<ArcRwLockWriteGuard<R, T>>

Attempts to lock this RwLock with writ access, through an Arc.

This method is similar to the try_write method; however, it requires the RwLock to be inside of an Arc and the resulting write guard has no lifetime requirements.

§

impl<R, T> RwLock<R, T>
where R: RawRwLockFair, T: ?Sized,

pub unsafe fn force_unlock_read_fair(&self)

Forcibly unlocks a read lock using a fair unlock protocol.

This is useful when combined with mem::forget to hold a lock without the need to maintain a RwLockReadGuard object alive, for example when dealing with FFI.

§Safety

This method must only be called if the current thread logically owns a RwLockReadGuard but that guard has be discarded using mem::forget. Behavior is undefined if a rwlock is read-unlocked when not read-locked.

pub unsafe fn force_unlock_write_fair(&self)

Forcibly unlocks a write lock using a fair unlock protocol.

This is useful when combined with mem::forget to hold a lock without the need to maintain a RwLockWriteGuard object alive, for example when dealing with FFI.

§Safety

This method must only be called if the current thread logically owns a RwLockWriteGuard but that guard has be discarded using mem::forget. Behavior is undefined if a rwlock is write-unlocked when not write-locked.

§

impl<R, T> RwLock<R, T>
where R: RawRwLockTimed, T: ?Sized,

pub fn try_read_for( &self, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

pub fn try_read_until( &self, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

pub fn try_write_for( &self, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<RwLockWriteGuard<'_, R, T>>

Attempts to acquire this RwLock with exclusive write access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the exclusive access when it is dropped.

pub fn try_write_until( &self, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<RwLockWriteGuard<'_, R, T>>

Attempts to acquire this RwLock with exclusive write access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the exclusive access when it is dropped.

pub fn try_read_arc_for( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to acquire this RwLock with read access until a timeout is reached, through an Arc.

This method is similar to the try_read_for method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_read_arc_until( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to acquire this RwLock with read access until a timeout is reached, through an Arc.

This method is similar to the try_read_until method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_write_arc_for( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<ArcRwLockWriteGuard<R, T>>

Attempts to acquire this RwLock with write access until a timeout is reached, through an Arc.

This method is similar to the try_write_for method; however, it requires the RwLock to be inside of an Arc and the resulting write guard has no lifetime requirements.

pub fn try_write_arc_until( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<ArcRwLockWriteGuard<R, T>>

Attempts to acquire this RwLock with read access until a timeout is reached, through an Arc.

This method is similar to the try_write_until method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

§

impl<R, T> RwLock<R, T>
where R: RawRwLockRecursive, T: ?Sized,

pub fn read_recursive(&self) -> RwLockReadGuard<'_, R, T>

Locks this RwLock with shared read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers which hold the lock. There may be other readers currently inside the lock when this method returns.

Unlike read, this method is guaranteed to succeed without blocking if another read lock is held at the time of the call. This allows a thread to recursively lock a RwLock. However using this method can cause writers to starve since readers no longer block if a writer is waiting for the lock.

Returns an RAII guard which will release this thread’s shared access once it is dropped.

pub fn try_read_recursive(&self) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access.

If the access could not be granted at this time, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

This method is guaranteed to succeed if another read lock is held at the time of the call. See the documentation for read_recursive for details.

This function does not block.

pub fn read_arc_recursive(self: &Arc<RwLock<R, T>>) -> ArcRwLockReadGuard<R, T>

Locks this RwLock with shared read access, through an Arc.

This method is similar to the read_recursive method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_read_recursive_arc( self: &Arc<RwLock<R, T>>, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to lock this RwLock with shared read access, through an Arc.

This method is similar to the try_read_recursive method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

§

impl<R, T> RwLock<R, T>

pub fn try_read_recursive_for( &self, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

This method is guaranteed to succeed without blocking if another read lock is held at the time of the call. See the documentation for read_recursive for details.

pub fn try_read_recursive_until( &self, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<RwLockReadGuard<'_, R, T>>

Attempts to acquire this RwLock with shared read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

pub fn try_read_arc_recursive_for( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to lock this RwLock with read access until a timeout is reached, through an Arc.

This method is similar to the try_read_recursive_for method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_read_arc_recursive_until( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<ArcRwLockReadGuard<R, T>>

Attempts to lock this RwLock with read access until a timeout is reached, through an Arc.

This method is similar to the try_read_recursive_until method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

§

impl<R, T> RwLock<R, T>
where R: RawRwLockUpgrade, T: ?Sized,

pub unsafe fn make_upgradable_guard_unchecked( &self, ) -> RwLockUpgradableReadGuard<'_, R, T>

Creates a new RwLockUpgradableReadGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds an upgradable read lock.

This function does not increment the read count of the lock. Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.

pub fn upgradable_read(&self) -> RwLockUpgradableReadGuard<'_, R, T>

Locks this RwLock with upgradable read access, blocking the current thread until it can be acquired.

The calling thread will be blocked until there are no more writers or other upgradable reads which hold the lock. There may be other readers currently inside the lock when this method returns.

Returns an RAII guard which will release this thread’s shared access once it is dropped.

pub fn try_upgradable_read(&self) -> Option<RwLockUpgradableReadGuard<'_, R, T>>

Attempts to acquire this RwLock with upgradable read access.

If the access could not be granted at this time, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

This function does not block.

pub unsafe fn make_upgradable_arc_guard_unchecked( self: &Arc<RwLock<R, T>>, ) -> ArcRwLockUpgradableReadGuard<R, T>

Creates a new ArcRwLockUpgradableReadGuard without checking if the lock is held.

§Safety

This method must only be called if the thread logically holds an upgradable read lock.

This function does not increment the read count of the lock. Calling this function when a guard has already been produced is undefined behaviour unless the guard was forgotten with mem::forget.`

pub fn upgradable_read_arc( self: &Arc<RwLock<R, T>>, ) -> ArcRwLockUpgradableReadGuard<R, T>

Locks this RwLock with upgradable read access, through an Arc.

This method is similar to the upgradable_read method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_upgradable_read_arc( self: &Arc<RwLock<R, T>>, ) -> Option<ArcRwLockUpgradableReadGuard<R, T>>

Attempts to lock this RwLock with upgradable read access, through an Arc.

This method is similar to the try_upgradable_read method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

§

impl<R, T> RwLock<R, T>

pub fn try_upgradable_read_for( &self, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<RwLockUpgradableReadGuard<'_, R, T>>

Attempts to acquire this RwLock with upgradable read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

pub fn try_upgradable_read_until( &self, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<RwLockUpgradableReadGuard<'_, R, T>>

Attempts to acquire this RwLock with upgradable read access until a timeout is reached.

If the access could not be granted before the timeout expires, then None is returned. Otherwise, an RAII guard is returned which will release the shared access when it is dropped.

pub fn try_upgradable_read_arc_for( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Duration, ) -> Option<ArcRwLockUpgradableReadGuard<R, T>>

Attempts to lock this RwLock with upgradable access until a timeout is reached, through an Arc.

This method is similar to the try_upgradable_read_for method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

pub fn try_upgradable_read_arc_until( self: &Arc<RwLock<R, T>>, timeout: <R as RawRwLockTimed>::Instant, ) -> Option<ArcRwLockUpgradableReadGuard<R, T>>

Attempts to lock this RwLock with upgradable access until a timeout is reached, through an Arc.

This method is similar to the try_upgradable_read_until method; however, it requires the RwLock to be inside of an Arc and the resulting read guard has no lifetime requirements.

Trait Implementations§

§

impl<R, T> Debug for RwLock<R, T>
where R: RawRwLock, T: Debug + ?Sized,

§

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

Formats the value using the given formatter. Read more
§

impl<R, T> Default for RwLock<R, T>
where R: RawRwLock, T: Default + ?Sized,

§

fn default() -> RwLock<R, T>

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

impl<'de, R, T> Deserialize<'de> for RwLock<R, T>
where R: RawRwLock, T: Deserialize<'de> + ?Sized,

§

fn deserialize<D>( deserializer: D, ) -> Result<RwLock<R, T>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<R, T> From<T> for RwLock<R, T>
where R: RawRwLock,

§

fn from(t: T) -> RwLock<R, T>

Converts to this type from the input type.
§

impl<R, T> Serialize for RwLock<R, T>
where R: RawRwLock, T: Serialize + ?Sized,

§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<R, T> Send for RwLock<R, T>
where R: RawRwLock + Send, T: Send + ?Sized,

§

impl<R, T> Sync for RwLock<R, T>
where R: RawRwLock + Sync, T: Send + Sync + ?Sized,

Auto Trait Implementations§

§

impl<R, T> !Freeze for RwLock<R, T>

§

impl<R, T> !RefUnwindSafe for RwLock<R, T>

§

impl<R, T> Unpin for RwLock<R, T>
where R: Unpin, T: Unpin + ?Sized,

§

impl<R, T> UnwindSafe for RwLock<R, T>
where R: UnwindSafe, T: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> Conv for T

§

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

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

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where 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) -> R
where 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) -> R
where 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) -> R
where 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, ) -> R
where 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) -> R
where 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) -> R
where 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) -> R
where 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, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

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

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where 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)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

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

impl<T> To for T
where T: ?Sized,

§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
§

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

Tries to convert to T by calling TryInto<T>::try_into.
§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T

§

impl<T> Ungil for T
where T: Send,

Source§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,