AsLockWriteGuard

Struct AsLockWriteGuard 

Source
pub struct AsLockWriteGuard<'w, T> { /* private fields */ }
Expand description

Guard used for updating the tables.

Implementations§

Source§

impl<'w, T> AsLockWriteGuard<'w, T>

Source

pub fn update_tables<'a, R>( &'a mut self, update: impl UpdateTables<'a, T, R> + 'static + Sized + Send, ) -> R

Takes an update which will change the state of the underlying data. This is done through the interface of UpdateTables.

Users should never use the return value to directly mutate the tables, since this will lead to them going out of sync.

The update passed in must be valid for ’static because it will outlive the AsLockWriteGuard taking the update, so we can’t make any limitations on it.

Source

pub fn update_tables_closure<R>( &mut self, update: impl Fn(&mut T) -> R + 'static + Sized + Send, ) -> R

Like update_tables but allows the user to pass a closure for convenience. Only allows return values that own their data.

TODO: Consider allowing return values that have lifetimes, this should likely be as safe as the explicit UpdateTables trait.

Trait Implementations§

Source§

impl<'w, T: Debug> Debug for AsLockWriteGuard<'w, T>

Source§

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

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

impl<'w, T> Deref for AsLockWriteGuard<'w, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'w, T> Drop for AsLockWriteGuard<'w, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'w, T> Freeze for AsLockWriteGuard<'w, T>

§

impl<'w, T> !RefUnwindSafe for AsLockWriteGuard<'w, T>

§

impl<'w, T> !Send for AsLockWriteGuard<'w, T>

§

impl<'w, T> !Sync for AsLockWriteGuard<'w, T>

§

impl<'w, T> Unpin for AsLockWriteGuard<'w, T>

§

impl<'w, T> !UnwindSafe for AsLockWriteGuard<'w, T>

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> 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.