pub struct UsageFilter {
pub tenant_id: Option<String>,
pub model: Option<String>,
pub provider: Option<String>,
pub since_ms: Option<u64>,
pub until_ms: Option<u64>,
pub limit: Option<usize>,
}Expand description
Filter for querying usage records.
Fields§
§tenant_id: Option<String>Filter by tenant ID
model: Option<String>Filter by model
provider: Option<String>Filter by provider
since_ms: Option<u64>Records since this timestamp (Unix ms)
until_ms: Option<u64>Records until this timestamp (Unix ms)
limit: Option<usize>Maximum number of records to return
Implementations§
Source§impl UsageFilter
impl UsageFilter
Sourcepub fn for_tenant(tenant_id: impl Into<String>) -> Self
pub fn for_tenant(tenant_id: impl Into<String>) -> Self
Create a filter for a specific tenant.
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Filter by model.
Sourcepub fn with_provider(self, provider: impl Into<String>) -> Self
pub fn with_provider(self, provider: impl Into<String>) -> Self
Filter by provider.
Sourcepub fn since_duration(self, duration: Duration) -> Self
pub fn since_duration(self, duration: Duration) -> Self
Filter records since a duration ago.
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Limit the number of records.
Sourcepub fn matches(&self, record: &UsageRecord) -> bool
pub fn matches(&self, record: &UsageRecord) -> bool
Check if a record matches this filter.
Trait Implementations§
Source§impl Clone for UsageFilter
impl Clone for UsageFilter
Source§fn clone(&self) -> UsageFilter
fn clone(&self) -> UsageFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UsageFilter
impl Debug for UsageFilter
Source§impl Default for UsageFilter
impl Default for UsageFilter
Source§fn default() -> UsageFilter
fn default() -> UsageFilter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UsageFilter
impl RefUnwindSafe for UsageFilter
impl Send for UsageFilter
impl Sync for UsageFilter
impl Unpin for UsageFilter
impl UnwindSafe for UsageFilter
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