Trait Theory

Source
pub trait Theory {
    // Required methods
    fn chaos(&mut self, callback: &dyn Fn() -> bool) -> &mut Self;
    fn theorem<T: PartialEq>(
        &mut self,
        expected: T,
        actual: &dyn Fn() -> T,
    ) -> &mut Self;
    fn theory<T: PartialEq>(
        &mut self,
        expected: T,
        callback: &dyn Fn() -> T,
    ) -> &mut Self;
}
Expand description

§Add theory useful method

Required Methods§

Source

fn chaos(&mut self, callback: &dyn Fn() -> bool) -> &mut Self

§A theory must be equal to false
  • callback The callback to execute
Source

fn theorem<T: PartialEq>( &mut self, expected: T, actual: &dyn Fn() -> T, ) -> &mut Self

§Check if a theorem is true
  • expected The expected value
  • actual The actual value
Source

fn theory<T: PartialEq>( &mut self, expected: T, callback: &dyn Fn() -> T, ) -> &mut Self

§Test a theory
  • expected The expect callback result
  • callback The callback to execute

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.

Implementors§