pub enum Tokens {
Exact(u64),
Bound(u64),
}Expand description
A token count for one part of a request.
Variants§
Exact(u64)
Counted with the provider’s own tokenizer.
Bound(u64)
An upper bound, from the part’s byte length.
Implementations§
Source§impl Tokens
impl Tokens
Sourcepub fn bound_of_text(text: &str) -> Self
pub fn bound_of_text(text: &str) -> Self
The byte bound of text.
Sourcepub fn bound_of_json<T: Serialize + ?Sized>(
value: &T,
) -> Result<Self, IdentityError>
pub fn bound_of_json<T: Serialize + ?Sized>( value: &T, ) -> Result<Self, IdentityError>
The byte bound of value’s RFC 8785 (JCS) canonical JSON: the bound
of a schema (a role’s fields or questions) as the provider receives
it.
pub fn count(self) -> u64
pub fn is_exact(self) -> bool
Trait Implementations§
impl Copy for Tokens
impl Eq for Tokens
impl StructuralPartialEq for Tokens
Auto Trait Implementations§
impl Freeze for Tokens
impl RefUnwindSafe for Tokens
impl Send for Tokens
impl Sync for Tokens
impl Unpin for Tokens
impl UnsafeUnpin for Tokens
impl UnwindSafe for Tokens
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