cfg_expr::expr

Trait Logic

Source
pub trait Logic {
    // Required methods
    fn top() -> Self;
    fn bottom() -> Self;
    fn and(self, other: Self) -> Self;
    fn or(self, other: Self) -> Self;
    fn not(self) -> Self;
}
Expand description

A propositional logic used to evaluate Expression instances.

An Expression consists of some predicates and the any, all and not operators. An implementation of Logic defines how the any, all and not operators should be evaluated.

Required Methods§

Source

fn top() -> Self

The result of an all operation with no operands, akin to Boolean true.

Source

fn bottom() -> Self

The result of an any operation with no operands, akin to Boolean false.

Source

fn and(self, other: Self) -> Self

AND, which corresponds to the all operator.

Source

fn or(self, other: Self) -> Self

OR, which corresponds to the any operator.

Source

fn not(self) -> Self

NOT, which corresponds to the not operator.

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.

Implementations on Foreign Types§

Source§

impl Logic for Option<bool>

A three-valued logic – None stands for the value being unknown.

The truth tables for this logic are described on Wikipedia.

Source§

fn top() -> Self

Source§

fn bottom() -> Self

Source§

fn and(self, other: Self) -> Self

Source§

fn or(self, other: Self) -> Self

Source§

fn not(self) -> Self

Source§

impl Logic for bool

A boolean logic.

Source§

fn top() -> Self

Source§

fn bottom() -> Self

Source§

fn and(self, other: Self) -> Self

Source§

fn or(self, other: Self) -> Self

Source§

fn not(self) -> Self

Implementors§