Skip to main content

Oracle

Trait Oracle 

Source
pub trait Oracle<Candidate> {
    // Required method
    fn accepts(&self, candidate: &Candidate) -> bool;
}
Expand description

A predicate that marks valid candidates, the oracle of a quantum search.

The predicate must be pure: the same candidate always gets the same answer, since the algorithms count oracle queries.

Required Methods§

Source

fn accepts(&self, candidate: &Candidate) -> bool

Whether candidate is a solution.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<Candidate, O: Oracle<Candidate> + ?Sized> Oracle<Candidate> for &O

A reference to an oracle is an oracle, so a PhaseOracle can borrow one.

Source§

fn accepts(&self, candidate: &Candidate) -> bool

Implementors§