pub struct ReflectionStore { /* private fields */ }Expand description
Stores reflection results across turns.
Implementations§
Source§impl ReflectionStore
impl ReflectionStore
pub fn new() -> Self
Sourcepub fn record(&mut self, output: &str, critique: &str, score: f64) -> usize
pub fn record(&mut self, output: &str, critique: &str, score: f64) -> usize
Record a reflection and return its id.
Sourcepub fn record_with_suggestion(
&mut self,
output: &str,
critique: &str,
score: f64,
suggestion: &str,
) -> usize
pub fn record_with_suggestion( &mut self, output: &str, critique: &str, score: f64, suggestion: &str, ) -> usize
Record with a suggestion.
pub fn get(&self, id: usize) -> Option<&ReflectionResult>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn passing(&self, threshold: f64) -> Vec<&ReflectionResult>
pub fn passing(&self, threshold: f64) -> Vec<&ReflectionResult>
Entries that pass a given threshold.
Sourcepub fn failing(&self, threshold: f64) -> Vec<&ReflectionResult>
pub fn failing(&self, threshold: f64) -> Vec<&ReflectionResult>
Entries below threshold.
Sourcepub fn best(&self) -> Option<&ReflectionResult>
pub fn best(&self) -> Option<&ReflectionResult>
Best-scoring entry.
pub fn clear(&mut self)
Trait Implementations§
Source§impl Default for ReflectionStore
impl Default for ReflectionStore
Source§fn default() -> ReflectionStore
fn default() -> ReflectionStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ReflectionStore
impl RefUnwindSafe for ReflectionStore
impl Send for ReflectionStore
impl Sync for ReflectionStore
impl Unpin for ReflectionStore
impl UnsafeUnpin for ReflectionStore
impl UnwindSafe for ReflectionStore
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