Skip to main content

Bounded

Struct Bounded 

Source
pub struct Bounded<B> { /* private fields */ }
Expand description

A RelationalBackend whose every call is cut off after bound.

Implementations§

Source§

impl<B> Bounded<B>

Source

pub fn new(inner: B, bound: Duration) -> Self

Wrap inner so that no call waits longer than bound.

Source

pub fn inner(&self) -> &B

The wrapped backend (its calls are not bounded).

Source

pub fn bound(&self) -> Duration

The per-call bound.

Trait Implementations§

Source§

impl<B: Clone> Clone for Bounded<B>

Source§

fn clone(&self) -> Self

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<B: Debug> Debug for Bounded<B>

Source§

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

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

impl<B: RelationalBackend> RelationalBackend for Bounded<B>

Source§

type Tx<'a> = BoundedTx<<B as RelationalBackend>::Tx<'a>> where Self: 'a

A transaction on this backend. Dropping it without commit rolls it back.
Source§

fn backend(&self) -> &str

The backend’s name as it appears in matrix rows (postgres).
Source§

fn version(&self) -> &str

The server version string as it appears in matrix rows (16.15).
Source§

fn dialect(&self) -> Dialect

The dialect statements must be written in.
Source§

async fn execute(&self, sql: &str, params: &[Value]) -> Result<u64, RelError>

Run a statement that returns no rows; the result is the number of rows affected.
Source§

async fn query(&self, sql: &str, params: &[Value]) -> Result<Vec<Row>, RelError>

Run a statement and return its rows.
Source§

async fn begin(&self, isolation: Isolation) -> Result<Self::Tx<'_>, RelError>

Begin a transaction at (at least) isolation.
Source§

fn call_bound(&self) -> Option<Duration>

The per-call timeout this backend enforces, if one is configured; None (the default) means a call waits as long as the server does. Every call that takes longer returns RelError::Timeout.
Source§

async fn with_lock_held<'a>( &'a self, lock_sql: &'a str, at_most: Duration, during: Pin<Box<dyn Future<Output = ()> + Send + 'a>>, ) -> Result<(), RelError>

Test support for kv.bounded_call: take lock_sql (a statement that locks a row) in a transaction of its own, drive during while that lock is held, then roll back. during is dropped, unfinished, after at_most, so a broken bound cannot hang the test. A backend that enforces no bound returns RelError::Unsupported.

Auto Trait Implementations§

§

impl<B> Freeze for Bounded<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for Bounded<B>
where B: RefUnwindSafe,

§

impl<B> Send for Bounded<B>
where B: Send,

§

impl<B> Sync for Bounded<B>
where B: Sync,

§

impl<B> Unpin for Bounded<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for Bounded<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for Bounded<B>
where B: UnwindSafe,

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

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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