pub trait Superposition<T> {
// Required methods
fn from_states(states: Vec<T>, amplitudes: Vec<Complex64>) -> Result<Self>
where Self: Sized;
fn collapse(&mut self) -> T;
fn probability(&self, state: &T) -> f64;
fn transform<F>(&mut self, f: F) -> Result<()>
where F: Fn(&mut T);
}Expand description
Superposition trait for objects that can exist in multiple states
Required Methods§
Sourcefn from_states(states: Vec<T>, amplitudes: Vec<Complex64>) -> Result<Self>where
Self: Sized,
fn from_states(states: Vec<T>, amplitudes: Vec<Complex64>) -> Result<Self>where
Self: Sized,
Create superposition from multiple states
Sourcefn probability(&self, state: &T) -> f64
fn probability(&self, state: &T) -> f64
Get probability of specific state
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.