Trait Dimacs

Source
pub trait Dimacs: Copy + Eq {
    const MAX_DIMACS: isize;

    // Required methods
    fn from_dimacs(value: isize) -> Self;
    fn dimacs(self) -> isize;
}
Expand description

Type that can be used to represent literals and variables in DIMACS CNF and related file formats.

Required Associated Constants§

Source

const MAX_DIMACS: isize

Largest literal / variable supported.

Required Methods§

Source

fn from_dimacs(value: isize) -> Self

Returns a literal / variable that is encoded as the passed integer in the DIMACS CNF format.

If the value is out of range, e.g. negative for a variable, this may panic or return an arbitrary value.

Source

fn dimacs(self) -> isize

Returns the integer that is used to encode this literal / variable in the DIMACS CNF format.

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 Dimacs for i8

Source§

const MAX_DIMACS: isize = 127isize

Source§

fn from_dimacs(value: isize) -> Self

Source§

fn dimacs(self) -> isize

Source§

impl Dimacs for i16

Source§

const MAX_DIMACS: isize = 32_767isize

Source§

fn from_dimacs(value: isize) -> Self

Source§

fn dimacs(self) -> isize

Source§

impl Dimacs for i32

Source§

const MAX_DIMACS: isize = 2_147_483_647isize

Source§

fn from_dimacs(value: isize) -> Self

Source§

fn dimacs(self) -> isize

Source§

impl Dimacs for i64

Source§

const MAX_DIMACS: isize = 9_223_372_036_854_775_807isize

Source§

fn from_dimacs(value: isize) -> Self

Source§

fn dimacs(self) -> isize

Source§

impl Dimacs for isize

Source§

const MAX_DIMACS: isize = 9_223_372_036_854_775_807isize

Source§

fn from_dimacs(value: isize) -> Self

Source§

fn dimacs(self) -> isize

Implementors§