pub struct ProfileUsageService { /* private fields */ }Expand description
Reads the profile usage windows for one user.
Cheap to clone — it holds the shared pool handle, so it can be built once at a router’s composition root and injected into handlers.
Implementations§
Source§impl ProfileUsageService
impl ProfileUsageService
pub const fn new(cost_repo: CostAnalyticsRepository) -> Self
pub const fn from_pool(pool: Arc<PgPool>) -> Self
pub async fn get_profile_usage( &self, user_id: &UserId, now: DateTime<Utc>, ) -> Result<BridgeProfileUsage>
pub async fn get_usage_window( &self, user_id: &UserId, now: DateTime<Utc>, span: Duration, ) -> Result<UsageWindow>
pub async fn list_top_models( &self, user_id: &UserId, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<Vec<ModelShare>>
Trait Implementations§
Source§impl Clone for ProfileUsageService
impl Clone for ProfileUsageService
Source§fn clone(&self) -> ProfileUsageService
fn clone(&self) -> ProfileUsageService
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ProfileUsageService
impl !UnwindSafe for ProfileUsageService
impl Freeze for ProfileUsageService
impl Send for ProfileUsageService
impl Sync for ProfileUsageService
impl Unpin for ProfileUsageService
impl UnsafeUnpin for ProfileUsageService
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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