Skip to main content

LocalStorageLayer

Struct LocalStorageLayer 

Source
pub struct LocalStorageLayer { /* private fields */ }
Expand description

Local storage layer that tracks modifications on top of a remote layer.

Provides transactional semantics: modifications are tracked locally without affecting the underlying remote layer or cache. Changes can be inspected via diff.

§Block-based Storage Strategy

  • latest_block_number: Current working block number (modifications in HashMap)
  • Keys queried at a block higher than the last modification of that key, queried at modifications HashMap
  • Blocks between first_forked_block_number and latest_block_number are in local_storage table
  • Blocks before first_forked_block_number come from remote provider

§Cloning

LocalStorageLayer is cheap to clone. The underlying modifications and deleted prefixes use Arc<RwLock<_>>, so clones share the same state.

§Thread Safety

The layer is Send + Sync and can be shared across async tasks. All operations use read/write locks which will block until the lock is acquired.

Implementations§

Source§

impl LocalStorageLayer

Source

pub fn new( parent: RemoteStorageLayer, first_forked_block_number: u32, first_forked_block_hash: H256, metadata: Metadata, ) -> Self

Create a new local storage layer.

§Arguments
  • parent - The remote storage layer to use as the base state
  • first_forked_block_number - The initial block number where the fork started
  • first_forked_block_hash - The hash of the first forked block
  • metadata - The runtime metadata at the fork point
§Returns

A new LocalStorageLayer with no modifications, with current_block_number set to first_forked_block_number + 1 (the block being built).

Source

pub fn get_current_block_number(&self) -> u32

Get the current block number.

Source

pub fn cache(&self) -> &StorageCache

Get a reference to the underlying storage cache.

This provides access to the cache for operations like clearing local storage.

Source

pub fn remote(&self) -> &RemoteStorageLayer

Get the underlying remote storage layer.

This provides access to the remote layer for operations that need to fetch data directly from the remote chain (e.g., block headers, bodies). The remote layer maintains a persistent connection to the RPC endpoint.

Source

pub fn fork_block_hash(&self) -> H256

Get the hash of the first forked block.

This is the block hash at which the fork was created, used for querying storage keys on the remote chain.

Source

pub async fn metadata_at( &self, block_number: u32, ) -> Result<Arc<Metadata>, LocalStorageError>

Get the metadata valid at a specific block number.

For blocks at or after the fork point, returns metadata from the local version tree. For blocks before the fork point, fetches metadata from the remote node.

§Arguments
  • block_number - The block number to get metadata for
§Returns
  • Ok(Arc<Metadata>) - The metadata valid at the given block
  • Err(_) - Lock error, RPC error, or metadata decode error
Source

pub fn register_metadata_version( &self, block_number: u32, metadata: Metadata, ) -> Result<(), LocalStorageError>

Register a new metadata version starting at the given block number.

This should be called when a runtime upgrade occurs (:code storage key changes) to record that a new metadata version is now active.

§Arguments
  • block_number - The block number where this metadata becomes valid
  • metadata - The new runtime metadata
§Returns
  • Ok(()) - Metadata version registered successfully
  • Err(_) - Lock error
Source

pub fn has_code_changed_at( &self, block_number: u32, ) -> Result<bool, LocalStorageError>

Check if the :code storage key was modified at the specified block.

This is used to detect runtime upgrades. When a runtime upgrade occurs in block X, the new runtime is used starting from block X+1. So when building X+1, we check if code changed in X (the parent) to determine if we’re now using a new runtime.

§Arguments
  • block_number - The block number to check for code modifications
§Returns
  • Ok(true) - The :code key was modified at the specified block
  • Ok(false) - The :code key was not modified at the specified block
  • Err(_) - Lock error
Source

pub async fn get( &self, block_number: u32, key: &[u8], ) -> Result<Option<Arc<LocalSharedValue>>, LocalStorageError>

Get a storage value, checking local modifications first.

§Arguments
  • key - The storage key to fetch
§Returns
  • Ok(Some(value)) - Value exists (either modified locally, in local_storage, or in parent)
  • Ok(None) - Key doesn’t exist or was deleted via prefix deletion
  • Err(_) - Lock error or parent layer error
§Behavior

Storage lookup strategy based on block_number:

  1. If block_number == latest_block_number or the key in local modifications is valid for this block: Check modifications HashMap, then remote at first_forked_block
  2. If first_forked_block_number < block_number < latest_block_number: Check local_storage table
  3. Otherwise: Check remote provider directly (fetches block_hash from blocks table)
Source

pub async fn next_key( &self, prefix: &[u8], key: &[u8], ) -> Result<Option<Vec<u8>>, LocalStorageError>

Get the next key after the given key that starts with the prefix.

§Arguments
  • prefix - Storage key prefix to match
  • key - The current key; returns the next key after this one
§Returns
  • Ok(Some(key)) - The next key after key that starts with prefix
  • Ok(None) - No more keys with this prefix
  • Err(_) - Lock error or parent layer error
§Behavior
  1. Queries the parent layer for the next key
  2. Skips keys that match deleted prefixes
  3. Does not consider locally modified keys (they are transient)
§Note

This method currently delegates directly to the parent layer. Locally modified keys are not included in key enumeration since they represent uncommitted changes.

Source

pub async fn keys_by_prefix( &self, prefix: &[u8], block_number: u32, ) -> Result<Vec<Vec<u8>>, LocalStorageError>

Enumerate all keys matching a prefix, merging remote and local state.

This method combines keys from the remote layer (at the fork point) with locally modified keys, producing a sorted, deduplicated list of keys that exist at the specified fork-local block.

For the latest block, uses the in-memory modifications and deleted_prefixes snapshots. For historical fork-local blocks, queries the persisted local values in the cache to reconstruct the key set that existed at that block.

Keys that were deleted locally (either individually via set(key, None) or via delete_prefix) are excluded.

Source

pub fn set( &self, key: &[u8], value: Option<&[u8]>, ) -> Result<(), LocalStorageError>

Set a storage value locally.

§Arguments
  • key - The storage key to set
  • value - The value to set, or None to mark as deleted
§Returns
  • Ok(()) - Value was set successfully
  • Err(_) - Lock error
§Behavior
  • Does not affect the parent layer or underlying cache
  • Overwrites any previous local modification for this key
  • Passing None marks the key as explicitly deleted (different from never set)
Source

pub fn set_initial( &self, key: &[u8], value: Option<&[u8]>, ) -> Result<(), LocalStorageError>

Set a storage value visible from the fork point onwards.

Unlike Self::set, which records the modification at the current working block, this marks the entry with last_modification_block = first_forked_block_number - 1 (saturating at 0) so it is visible immediately at the fork head and for any later fork-local query, but not for historical pre-fork queries. This is used for injecting initial state (e.g., dev accounts, sudo key) that should be readable before any block is built.

These entries are never committed to the persistent cache by Self::commit (which only commits entries at current_block_number), but they remain in the in-memory modifications map for the lifetime of the fork.

Source

pub async fn get_batch( &self, block_number: u32, keys: &[&[u8]], ) -> Result<Vec<Option<Arc<LocalSharedValue>>>, LocalStorageError>

Get multiple storage values in a batch.

§Arguments
  • block_number - The block number to query
  • keys - Slice of storage keys to fetch (as byte slices)
§Returns
  • Ok(vec) - Vector of optional values, in the same order as input keys
  • Err(_) - Lock error or parent layer error
§Behavior

Storage lookup strategy based on block_number (same as get):

  1. If block_number == latest_block_number: Check modifications HashMap, then remote at first_forked_block
  2. If first_forked_block_number < block_number < latest_block_number and the key is valid for block_number: Check modifications HashMap table
  3. If first_forked_block_number < block_number < latest_block_number: Check local_storage table
  4. Otherwise: Check remote provider directly (fetches block_hash from blocks table)
Source

pub fn set_batch( &self, entries: &[(&[u8], Option<&[u8]>)], ) -> Result<(), LocalStorageError>

Set multiple storage values locally in a batch.

§Arguments
  • entries - Slice of (key, value) pairs to set
§Returns
  • Ok(()) - All values were set successfully
  • Err(_) - Lock error
§Behavior
  • Does not affect the parent layer or underlying cache
  • Overwrites any previous local modifications for the given keys
  • None values mark keys as explicitly deleted
  • More efficient than calling set() multiple times due to single lock acquisition
Source

pub fn set_batch_initial( &self, entries: &[(&[u8], Option<&[u8]>)], ) -> Result<(), LocalStorageError>

Batch version of Self::set_initial.

Sets multiple storage values visible from the fork point onwards, using last_modification_block = first_forked_block_number - 1 (saturating at 0). See Self::set_initial for details.

Source

pub fn delete_prefix(&self, prefix: &[u8]) -> Result<(), LocalStorageError>

Delete all keys matching a prefix.

§Arguments
  • prefix - The prefix to match for deletion
§Returns
  • Ok(()) - Prefix was marked as deleted successfully
  • Err(_) - Lock error
§Behavior
  • Removes all locally modified keys that start with the prefix
  • Marks the prefix as deleted, affecting future get() calls
  • Keys in the parent layer matching this prefix will return None after this call
Source

pub fn is_deleted(&self, prefix: &[u8]) -> Result<bool, LocalStorageError>

Check if a prefix has been deleted.

§Arguments
  • prefix - The prefix to check
§Returns
  • Ok(true) - Prefix has been deleted via delete_prefix
  • Ok(false) - Prefix has not been deleted
  • Err(_) - Lock error
Source

pub fn diff( &self, ) -> Result<Vec<(Vec<u8>, Option<Arc<LocalSharedValue>>)>, LocalStorageError>

Get all local modifications as a vector.

§Returns
  • Ok(vec) - Vector of (key, value) pairs representing all local changes
  • Err(_) - Lock error
§Behavior
  • Returns only locally modified keys, not the full state
  • None values indicate keys that were explicitly deleted
  • Does not include keys deleted via prefix deletion
Source

pub async fn commit(&mut self) -> Result<(), LocalStorageError>

Commit modifications to the local storage tables, creating new validity entries.

§Returns
  • Ok(()) - All modifications were successfully committed to the cache
  • Err(_) - Lock error or cache error
§Behavior
  • Only commits modifications whose last_modification_block == latest_block_number
  • For each key to commit:
    • If key not in local_keys: insert key, then insert value with valid_from = latest_block_number
    • If key exists: close current open value (set valid_until), insert new value
  • The modifications HashMap remains intact and available after commit
  • Increases the latest block number
Source

pub fn child(&self) -> LocalStorageLayer

Create a child layer for nested modifications.

§Returns

A cloned LocalStorageLayer that shares the same parent and state.

§Behavior
  • The child shares the same modifications and deleted_prefixes via Arc
  • Changes in the child affect the parent and vice versa
  • Useful for creating temporary scopes that can be discarded
§Note

This is currently a simple clone. In the future, this may be updated to create true isolated child layers with proper parent-child relationships.

Trait Implementations§

Source§

impl Clone for LocalStorageLayer

Source§

fn clone(&self) -> LocalStorageLayer

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalStorageLayer

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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> CheckedConversion for T

Source§

fn checked_from<T>(t: T) -> Option<Self>
where Self: TryFrom<T>,

Convert from a value of T into an equivalent instance of Option<Self>. Read more
Source§

fn checked_into<T>(self) -> Option<T>
where Self: TryInto<T>,

Consume self to return Some equivalent value of Option<T>. 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> Conv for T

Source§

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

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

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

Source§

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

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

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

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

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

Source§

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

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

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

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

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

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

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

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

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

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

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> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

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

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<I, T> ExtractContext<I, ()> for T

Source§

fn extract_context(self, _original_input: I)

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<Src, Dest> IntoTuple<Dest> for Src
where Dest: FromTuple<Src>,

Source§

fn into_tuple(self) -> Dest

Source§

impl<T, Outer> IsWrappedBy<Outer> for T
where Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,

Source§

fn from_ref(outer: &Outer) -> &T

Get a reference to the inner from the outer.

Source§

fn from_mut(outer: &mut Outer) -> &mut T

Get a mutable reference to the inner from the outer.

Source§

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

Source§

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

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

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

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

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

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

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

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

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

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<I> RecreateContext<I> for I

Source§

fn recreate_context(_original_input: I, tail: I) -> I

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred. Read more
Source§

impl<T, Conn> RunQueryDsl<Conn> for T

Source§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnectionCore + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
Source§

fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
Source§

fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn, ) -> Self::LoadFuture<'conn>
where Conn: AsyncConnectionCore, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a [Stream] with the returned rows. Read more
Source§

fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
Source§

fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
Source§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, LoadNext<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatedConversion for T

Source§

fn saturated_from<T>(t: T) -> Self
where Self: UniqueSaturatedFrom<T>,

Convert from a value of T into an equivalent instance of Self. Read more
Source§

fn saturated_into<T>(self) -> T
where Self: UniqueSaturatedInto<T>,

Consume self to return an equivalent value of T. Read more
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

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

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

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

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

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

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

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

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

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

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

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

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

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

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

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

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.
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> TryConv for T

Source§

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<S, T> UncheckedInto<T> for S
where T: UncheckedFrom<S>,

Source§

fn unchecked_into(self) -> T

The counterpart to unchecked_from.
Source§

impl<T, S> UniqueSaturatedInto<T> for S
where T: Bounded, S: TryInto<T>,

Source§

fn unique_saturated_into(self) -> T

Consume self to return an equivalent value of T.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> MaybeDebug for T
where T: Debug,

Source§

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