Struct cassie::Variable[][src]

pub struct Variable {
    pub symbol: char,
}

A variable represents a value which is arbitrary or unknown.

The assumption that this object will eventually be assigned a meaningful value is the basis of algebraic manipulation.

Fields

Methods

impl Variable
[src]

Creates a variable with associated symbol symbol.

Examples

use cassie::Variable;
let x = Variable::named('x');
assert_eq!(x.symbol, 'x');
let v = Variable::named('ν');
assert_eq!(v.symbol, 'ν');

An alias for Variable::named.

Examples

use cassie::Variable;
let x = Variable::new('x');
assert_eq!(x.symbol, 'x');
let v = Variable::new('ν');
assert_eq!(v.symbol, 'ν');

Trait Implementations

impl Clone for Variable
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Variable
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for Variable
[src]

Variables may be printed using the fmt::Debug trait.

Examples

use cassie::Variable;
let var = Variable::named('x');
assert_eq!(&format!("{:?}", var), "x");
let var = Variable::named('α');
assert_eq!(&format!("{:?}", var), "α");

impl FromStr for Variable
[src]

The associated error which can be returned from parsing.

Variables may be constructed from string literals, provided that they are well-formed.

Examples

use cassie::Variable;
assert_eq!(Variable { symbol: 'x' }, "x".parse::<Variable>().unwrap());
assert_eq!(Variable { symbol: 'Γ' }, "Γ".parse::<Variable>().unwrap());
// Note that variable names must comprise exactly one character.
assert!("".parse::<Variable>().is_err());
assert!("xy".parse::<Variable>().is_err());

Auto Trait Implementations

impl Send for Variable

impl Sync for Variable