Skip to main content

Lock

Struct Lock 

Source
pub struct Lock {
    pub strength: Option<LockStrength>,
    pub tables: Vec<Cow<'static, str>>,
    pub wait: Option<LockWait>,
}
Expand description

FOR <strength> [OF table, …] [NOWAIT | SKIP LOCKED]

From PostgreSQL 17:

FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE }
    [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ]

Never contributes a bound argument: the OF list is table names.

Fields§

§strength: Option<LockStrength>

How strong a lock. None is how a default-constructed lock stays absent — there is no FOR clause without a strength.

§tables: Vec<Cow<'static, str>>

Restrict the lock to these tables of the statement. Quoted.

§wait: Option<LockWait>

What to do when a row is already locked. The default is to wait.

Implementations§

Source§

impl Lock

Source

pub fn new(strength: LockStrength) -> Self

A lock of strength over every table in the statement.

Source

pub fn append_table( &mut self, tables: impl IntoIterator<Item = impl Into<Cow<'static, str>>>, )

Restrict the lock to these tables.

Source

pub fn is_empty(&self) -> bool

Whether the clause is absent.

Trait Implementations§

Source§

impl Clone for Lock

Source§

fn clone(&self) -> Lock

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Lock

Source§

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

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

impl Default for Lock

Source§

fn default() -> Lock

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

impl Expression for Lock

Source§

fn write_sql(&self, w: &mut SqlWriter<'_>)

Append this fragment to w. Read more

Auto Trait Implementations§

§

impl Freeze for Lock

§

impl RefUnwindSafe for Lock

§

impl Send for Lock

§

impl Sync for Lock

§

impl Unpin for Lock

§

impl UnsafeUnpin for Lock

§

impl UnwindSafe for Lock

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.