[][src]Trait mcts::transposition_table::TranspositionTable

pub unsafe trait TranspositionTable<Spec: MCTS>: Sync + Sized {
    fn insert<'a>(
        &'a self,
        key: &Spec::State,
        value: &'a SearchNode<Spec>,
        handle: SearchHandle<Spec>
    ) -> Option<&'a SearchNode<Spec>>;
fn lookup<'a>(
        &'a self,
        key: &Spec::State,
        handle: SearchHandle<Spec>
    ) -> Option<&'a SearchNode<Spec>>; }

Required methods

fn insert<'a>(
    &'a self,
    key: &Spec::State,
    value: &'a SearchNode<Spec>,
    handle: SearchHandle<Spec>
) -> Option<&'a SearchNode<Spec>>

If this function inserts a value, it must return None. Failure to follow this rule will lead to memory safety violation.

Attempts to insert a key/value pair.

If the key is not present, the table may insert it. If the table does not insert it, the table may either return None or a reference to another value existing in the table. (The latter is allowed so that the table doesn't necessarily need to handle hash collisions, but it will negatively affect the accuracy of the search.)

If the key is present, the table may either:

  • Leave the table unchanged and return Some(reference to associated value).
  • Leave the table unchanged and return None.

The table may choose to replace old values. The table is not responsible for dropping values that are replaced.

fn lookup<'a>(
    &'a self,
    key: &Spec::State,
    handle: SearchHandle<Spec>
) -> Option<&'a SearchNode<Spec>>

Looks up a key.

If the key is not present, the table should almost always return None.

If the key is present, the table may return either None or a reference to the associated value.

Loading content...

Implementations on Foreign Types

impl<Spec: MCTS<TranspositionTable = Self>> TranspositionTable<Spec> for ()[src]

Loading content...

Implementors

impl<Spec> TranspositionTable<Spec> for ApproxTable<Spec> where
    Spec::State: TranspositionHash,
    Spec: MCTS
[src]

Loading content...