Struct lp_solvers::util::UniqueNameGenerator[][src]

pub struct UniqueNameGenerator { /* fields omitted */ }

Useful to generate a list of unique valid variable names

Implementations

impl UniqueNameGenerator[src]

pub fn add_variable<'a>(&mut self, name: &'a str) -> Cow<'a, str>[src]

Create a new variable. Returns a valid variable name, never returned before by this generator.

use lp_solvers::util::UniqueNameGenerator;

let mut gen = UniqueNameGenerator::default();
assert_eq!(gen.add_variable("x"), "x");
assert_eq!(gen.add_variable("y"), "y");
assert_eq!(gen.add_variable("z"), "z");
assert_eq!(gen.add_variable("!#?/"), "v"); // "!#?/" is not a valid variable name
assert_eq!(gen.add_variable("x"), "x2"); // A variable with name x is already present

Trait Implementations

impl Debug for UniqueNameGenerator[src]

impl Default for UniqueNameGenerator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,