pub struct Mutable<'transaction, T: Table> { /* private fields */ }Expand description
Mutable access to columns of a single table row.
The whole row is retrieved and can be inspected from Rust code.
However, only rows that are not used in a #[unique]
constraint can be updated using Mutable.
To update columns with a unique constraint, please use Transaction::update for now.
Mutable only executes an UPDATE statement when it is dropped.
This delay can not be observed because the transaction is borrowed mutably.
Implementations§
Source§impl<'transaction, T: Table> Mutable<'transaction, T>
impl<'transaction, T: Table> Mutable<'transaction, T>
Sourcepub fn into_table_row(self) -> TableRow<T>
pub fn into_table_row(self) -> TableRow<T>
Sourcepub fn unique<O>(
&mut self,
f: impl FnOnce(&mut <T::Mutable as Deref>::Target) -> O,
) -> Result<O, T::Conflict>
pub fn unique<O>( &mut self, f: impl FnOnce(&mut <T::Mutable as Deref>::Target) -> O, ) -> Result<O, T::Conflict>
Update unique constraint columns.
When the update succeeds, this function returns Ok, when it fails it returns Err with one of three conflict types:
- 0 unique constraints => [Infallible]
- 1 unique constraint => TableRow reference to the conflicting table row.
- 2+ unique constraints =>
()no further information is provided.
If any of the changes made inside the closure conflict with an existing row, then all changes made inside the closure are reverted.
If the closure panics, then all changes made inside the closure are also reverted. Applying those changes is not possible, as conflicts can not be reported if there is a panic.
Trait Implementations§
Auto Trait Implementations§
impl<'transaction, T> !Freeze for Mutable<'transaction, T>
impl<'transaction, T> !RefUnwindSafe for Mutable<'transaction, T>
impl<'transaction, T> !Send for Mutable<'transaction, T>
impl<'transaction, T> !Sync for Mutable<'transaction, T>
impl<'transaction, T> Unpin for Mutable<'transaction, T>
impl<'transaction, T> !UnwindSafe for Mutable<'transaction, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
random to avoid conflict with the new gen keyword in Rust 2024.Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
random_rangeRng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
RngCore to a RngReadAdapter.