Struct CachedRequest

Source
pub struct CachedRequest<'client, C: Cache + Send + Sync + 'static, R: RateLimiter + Send + Sync + 'static, Conn: Connect + Clone + Send + Sync + 'static, const AUTHENTICATED: bool, const FORCE: bool> { /* private fields */ }

Trait Implementations§

Source§

impl<C: Cache + Send + Sync + 'static, R: RateLimiter + Send + Sync + 'static, Conn: Connect + Clone + Send + Sync + 'static, const AUTHENTICATED: bool, const FORCE: bool> Requester<AUTHENTICATED, FORCE> for CachedRequest<'_, C, R, Conn, AUTHENTICATED, FORCE>

Source§

type Caching = C

Source§

type Connector = Conn

Source§

type RateLimiting = R

Source§

fn cached( &self, cache_duration: Duration, ) -> CachedRequest<'_, Self::Caching, Self::RateLimiting, Self::Connector, AUTHENTICATED, FORCE>

overwrites the cache duration for all requests returned from this function ## Example Read more
Source§

fn forced( &self, ) -> CachedRequest<'_, Self::Caching, Self::RateLimiting, Self::Connector, AUTHENTICATED, true>

forces a fresh copy from the api Read more
Source§

fn get<'life0, 'async_trait, T>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<T, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + Clone + Send + Sync + FixedEndpoint + 'static, Self: 'async_trait, 'life0: 'async_trait,

call the fixed endpoint
Source§

fn single<'life0, 'async_trait, T, I>( &'life0 self, id: impl 'async_trait + Into<I> + Send, ) -> Pin<Box<dyn Future<Output = Result<T, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + Clone + Send + Sync + EndpointWithId<IdType = I> + 'static, I: 'async_trait + Display + DeserializeOwned + Hash + Send + Sync + Clone + 'static, Self: 'async_trait, 'life0: 'async_trait,

request a single item
Source§

fn try_get<'life0, 'life1, 'async_trait, T, I>( &'life0 self, id: impl 'async_trait + Into<&'life1 I> + Send, ) -> Pin<Box<dyn Future<Output = Option<T>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + Clone + Endpoint + Send + Sync + 'static, I: 'async_trait + DeserializeOwned + Display + Hash + Clone + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

retrieves an item from cache Read more
Source§

fn ids<'life0, 'async_trait, T, I>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<I>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + EndpointWithId<IdType = I> + Clone + Send + Sync + 'static, I: 'async_trait + Display + DeserializeOwned + Serialize + Hash + Clone + Send + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait,

request all available ids
Source§

fn many<'life0, 'async_trait, T, I>( &'life0 self, ids: Vec<impl 'async_trait + Into<I> + Send>, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + EndpointWithId<IdType = I> + BulkEndpoint + Clone + Send + Sync + 'static, I: 'async_trait + Display + DeserializeOwned + Hash + Clone + Eq + Send + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait,

request multiple ids at once
Source§

fn page<'life0, 'life1, 'async_trait, T>( &'life0 self, page: usize, page_size: u8, result: &'life1 mut Vec<T>, ) -> Pin<Box<dyn Future<Output = Result<usize, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + PagedEndpoint + Clone + Send + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

requests a page of items and returns the number of total items across all pages
Source§

fn all<'life0, 'async_trait, T, I>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + EndpointWithId<IdType = I> + BulkEndpoint + Clone + Send + Sync + 'static, I: 'async_trait + Display + DeserializeOwned + Serialize + Hash + Clone + Send + Sync + Eq + 'static, Self: 'async_trait, 'life0: 'async_trait,

requests all items using the most efficient method available Read more
Source§

fn get_all_by_ids_all<'life0, 'async_trait, T, I>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + EndpointWithId<IdType = I> + BulkEndpoint + Clone + Send + Sync + 'static, I: 'async_trait + Display + DeserializeOwned + Hash + Clone + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait,

Gets all items by querying ids=all Read more
Source§

fn get_all_by_paging<'life0, 'async_trait, T>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + PagedEndpoint + Clone + Send + Sync + 'static, Self: 'async_trait, 'life0: 'async_trait,

Gets all items by querying all pages Read more
Source§

fn get_all_by_requesting_ids<'life0, 'async_trait, T, I>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<T>, EndpointError>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + EndpointWithId<IdType = I> + BulkEndpoint + Clone + Send + Sync + 'static, I: 'async_trait + Display + DeserializeOwned + Serialize + Hash + Clone + Send + Sync + Eq + 'static, Self: 'async_trait, 'life0: 'async_trait,

Gets all items by querying all ids Read more

Auto Trait Implementations§

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> Freeze for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> !RefUnwindSafe for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> Send for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> Sync for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> Unpin for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

§

impl<'client, C, R, Conn, const AUTHENTICATED: bool, const FORCE: bool> !UnwindSafe for CachedRequest<'client, C, R, Conn, AUTHENTICATED, FORCE>

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> 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, 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<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> ErasedDestructor for T
where T: 'static,