#[non_exhaustive]pub struct ClassifierProfile {
pub calibration: Calibration,
pub max_state_chars: usize,
}Expand description
What a caller can learn about the adapter answering, short of its
identity: the family its confidence comes from, and how much state
it will carry before it truncates.
#[non_exhaustive]: what an adapter can report about itself grows, and
it should not be a breaking change for every caller.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.calibration: CalibrationThe family the adapter’s confidence numbers come from. See
Calibration — not comparable across families.
max_state_chars: usizeChars of state this adapter will send before it truncates.
Measured as the state’s UTF-8 byte length, so multi-byte text can
trim slightly under the limit — never mid-char.
Implementations§
Source§impl ClassifierProfile
impl ClassifierProfile
Sourcepub fn new(calibration: Calibration, max_state_chars: usize) -> Self
pub fn new(calibration: Calibration, max_state_chars: usize) -> Self
A profile with the calibration and the state ceiling given.
Sourcepub fn truncate<'a>(&self, state: &'a str) -> (&'a str, bool)
pub fn truncate<'a>(&self, state: &'a str) -> (&'a str, bool)
Truncate state to max_state_chars, deterministically and on a
char boundary: the same state and profile always produce the
same prefix. Returns the slice to send and whether anything was
dropped.
An adapter calls this as it builds its request, and logs when the
second element is true: a silently trimmed state produces a
confident wrong answer, and a log line is the only chance a
maintainer has of connecting the two.
Trait Implementations§
Source§impl Clone for ClassifierProfile
impl Clone for ClassifierProfile
impl Copy for ClassifierProfile
Source§impl Debug for ClassifierProfile
impl Debug for ClassifierProfile
impl Eq for ClassifierProfile
Source§impl PartialEq for ClassifierProfile
impl PartialEq for ClassifierProfile
impl StructuralPartialEq for ClassifierProfile
Auto Trait Implementations§
impl Freeze for ClassifierProfile
impl RefUnwindSafe for ClassifierProfile
impl Send for ClassifierProfile
impl Sync for ClassifierProfile
impl Unpin for ClassifierProfile
impl UnsafeUnpin for ClassifierProfile
impl UnwindSafe for ClassifierProfile
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.