#[non_exhaustive]pub struct ObservationPolicy {
pub origins: OriginFilter,
pub provenance: Provenance,
}Expand description
How a UsageLearner turns a trace stream into observations.
Default reproduces today’s behavior exactly, field for field — pinned by
the_default_policy_reproduces_todays_pairing_exactly. Build from it with
the with_* setters:
use ratel_ai_core::{ObservationPolicy, Origin, OriginFilter, Provenance};
// A baseline capture: only observed queries teach, and everything learned
// is marked as seeded.
let seeding = ObservationPolicy::default()
.with_origins(OriginFilter::Exactly(Origin::Baseline))
.with_provenance(Provenance::Seeded);
assert_eq!(seeding.provenance, Provenance::Seeded);
assert_eq!(ObservationPolicy::default().origins, OriginFilter::Any);The struct is #[non_exhaustive], which is what makes a future field
additive rather than breaking — and is also why the setters exist rather
than struct-literal syntax: a #[non_exhaustive] struct cannot be built
with a struct expression outside its defining crate at all, ..Default
included. Fields stay public for reading.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.origins: OriginFilterWhich searches open an observation window.
provenance: ProvenanceWhether what is learned is marked as seeded.
Implementations§
Source§impl ObservationPolicy
impl ObservationPolicy
Sourcepub fn with_origins(self, origins: OriginFilter) -> Self
pub fn with_origins(self, origins: OriginFilter) -> Self
Set which searches open an observation window.
Sourcepub fn with_provenance(self, provenance: Provenance) -> Self
pub fn with_provenance(self, provenance: Provenance) -> Self
Set whether what is learned is marked as seeded.
Trait Implementations§
Source§impl Clone for ObservationPolicy
impl Clone for ObservationPolicy
Source§fn clone(&self) -> ObservationPolicy
fn clone(&self) -> ObservationPolicy
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 moreimpl Copy for ObservationPolicy
Source§impl Debug for ObservationPolicy
impl Debug for ObservationPolicy
Source§impl Default for ObservationPolicy
impl Default for ObservationPolicy
Source§fn default() -> ObservationPolicy
fn default() -> ObservationPolicy
Returns the “default value” for a type. Read more
impl Eq for ObservationPolicy
Source§impl PartialEq for ObservationPolicy
impl PartialEq for ObservationPolicy
impl StructuralPartialEq for ObservationPolicy
Auto Trait Implementations§
impl Freeze for ObservationPolicy
impl RefUnwindSafe for ObservationPolicy
impl Send for ObservationPolicy
impl Sync for ObservationPolicy
impl Unpin for ObservationPolicy
impl UnsafeUnpin for ObservationPolicy
impl UnwindSafe for ObservationPolicy
Blanket Implementations§
impl<T> Boilerplate for T
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,
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
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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