pub struct LearnStatsProvider { /* private fields */ }Expand description
LearnStats と ScoreModel を一体管理する Provider
Stats を更新すると自動的に Model も再構築される。
rebuild_model() の呼び忘れを防止。
Implementations§
Source§impl LearnStatsProvider
impl LearnStatsProvider
pub fn new(stats: LearnStats) -> Self
Sourcepub fn stats(&self) -> &LearnStats
pub fn stats(&self) -> &LearnStats
Stats を取得(読み取り専用)
Sourcepub fn model(&self) -> &ScoreModel
pub fn model(&self) -> &ScoreModel
Model を取得
Sourcepub fn update_stats<F>(&mut self, f: F)where
F: FnOnce(&mut LearnStats),
pub fn update_stats<F>(&mut self, f: F)where
F: FnOnce(&mut LearnStats),
Stats を更新し、Model を自動再構築
Stats を直接変更したい場合はこのメソッドを使用。 Model の再構築忘れを防止。
Sourcepub fn replace_stats(&mut self, stats: LearnStats)
pub fn replace_stats(&mut self, stats: LearnStats)
Stats を置換し、Model を自動再構築
Trait Implementations§
Source§impl LearnedProvider for LearnStatsProvider
impl LearnedProvider for LearnStatsProvider
Source§fn query(&self, q: LearningQuery<'_>) -> LearningResult
fn query(&self, q: LearningQuery<'_>) -> LearningResult
クエリを実行してボーナス/スコアを取得
Source§fn stats(&self) -> Option<&LearnStats>
fn stats(&self) -> Option<&LearnStats>
内部の LearnStats を取得(永続化用、実装がある場合のみ)
Source§fn model(&self) -> Option<&ScoreModel>
fn model(&self) -> Option<&ScoreModel>
内部の ScoreModel を取得(実装がある場合のみ)
Auto Trait Implementations§
impl Freeze for LearnStatsProvider
impl RefUnwindSafe for LearnStatsProvider
impl Send for LearnStatsProvider
impl Sync for LearnStatsProvider
impl Unpin for LearnStatsProvider
impl UnwindSafe for LearnStatsProvider
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
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