pub struct LazyStrategicDatabase { /* private fields */ }Expand description
Lazy-loading strategic motif database
Implementations§
Source§impl LazyStrategicDatabase
impl LazyStrategicDatabase
Sourcepub fn new<P: AsRef<Path>>(
base_dir: P,
config: LazyLoadConfig,
) -> Result<Self, Box<dyn Error>>
pub fn new<P: AsRef<Path>>( base_dir: P, config: LazyLoadConfig, ) -> Result<Self, Box<dyn Error>>
Create new lazy-loading strategic database
Sourcepub fn get_motif(
&self,
motif_id: u64,
) -> Result<Option<StrategicMotif>, Box<dyn Error>>
pub fn get_motif( &self, motif_id: u64, ) -> Result<Option<StrategicMotif>, Box<dyn Error>>
Get a motif by ID, loading from disk if necessary
Sourcepub fn find_motifs_by_pattern(
&self,
pattern_hash: u64,
) -> Result<Vec<StrategicMotif>, Box<dyn Error>>
pub fn find_motifs_by_pattern( &self, pattern_hash: u64, ) -> Result<Vec<StrategicMotif>, Box<dyn Error>>
Find motifs matching a pattern hash
Sourcepub fn find_motifs_by_phase(
&self,
phase: &GamePhase,
) -> Result<Vec<StrategicMotif>, Box<dyn Error>>
pub fn find_motifs_by_phase( &self, phase: &GamePhase, ) -> Result<Vec<StrategicMotif>, Box<dyn Error>>
Find motifs relevant to a specific game phase
Sourcepub fn evaluate_position(
&self,
board: &Board,
) -> Result<Vec<MotifMatch>, Box<dyn Error>>
pub fn evaluate_position( &self, board: &Board, ) -> Result<Vec<MotifMatch>, Box<dyn Error>>
Evaluate a position against relevant strategic motifs
Sourcepub fn get_stats(&self) -> LazyLoadStats
pub fn get_stats(&self) -> LazyLoadStats
Get cache statistics
Sourcepub fn clear_caches(&self)
pub fn clear_caches(&self)
Clear all caches and reset statistics
Sourcepub fn preload_phase(&self, phase: GamePhase) -> Result<usize, Box<dyn Error>>
pub fn preload_phase(&self, phase: GamePhase) -> Result<usize, Box<dyn Error>>
Preload motifs for a specific game phase (optimization)
Sourcepub fn total_motifs(&self) -> usize
pub fn total_motifs(&self) -> usize
Get total number of available motifs
Sourcepub fn cached_motifs(&self) -> usize
pub fn cached_motifs(&self) -> usize
Get number of cached motifs
Auto Trait Implementations§
impl Freeze for LazyStrategicDatabase
impl RefUnwindSafe for LazyStrategicDatabase
impl Send for LazyStrategicDatabase
impl Sync for LazyStrategicDatabase
impl Unpin for LazyStrategicDatabase
impl UnwindSafe for LazyStrategicDatabase
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