[−][src]Struct surreal::Surreal
A struct to represent surreal numbers with non-infinite sets.
Methods
impl Surreal
[src]
pub fn new(left: Vec<&Surreal>, right: Vec<&Surreal>) -> Surreal
[src]
Creates a new surreal number given two vectors of references to surreal numbers. Each vector corresponds to a left set and a right set, where each number in the left set must be less than all numbers in the right set.
Panics
Panics if any Surreal
in left
is greater than or equal to any Surreal
in right
.
Examples
let zero = surreal::Surreal::new(vec![], vec![]); let one = surreal::Surreal::new(vec![&zero], vec![]); let neg_one = surreal::Surreal::new(vec![], vec![&zero]);
pub fn pseudo(left: Vec<&Surreal>, right: Vec<&Surreal>) -> Surreal
[src]
Creates a new pseudo-surreal number given two vectors of references to surreal numbers. While each vector still corresponds to a left set and a right set, each number in the left set doesn't have to be less than all numbers in the right set.
Examples
let zero = surreal::Surreal::new(vec![], vec![]); let pseudo = surreal::Surreal::pseudo(vec![&zero], vec![&zero]);
pub fn left(&self) -> Vec<Surreal>
[src]
Returns the left set of a surreal number (as a Vec<Surreal>
instead of a
Vec<&Surreal>
).
Examples
let zero = surreal::Surreal::new(vec![], vec![]); let one = surreal::Surreal::new(vec![&zero], vec![]); assert!(zero.left().is_empty()); assert!(one.left()[0] == zero);
pub fn right(&self) -> Vec<Surreal>
[src]
Returns the right set of a surreal number (as a Vec<Surreal>
instead of a
Vec<&Surreal>
).
Examples
let zero = surreal::Surreal::new(vec![], vec![]); let neg_one = surreal::Surreal::new(vec![], vec![&zero]); assert!(zero.right().is_empty()); assert!(neg_one.right()[0] == zero);
Trait Implementations
impl Clone for Surreal
[src]
impl Eq for Surreal
[src]
impl PartialEq<Surreal> for Surreal
[src]
impl PartialOrd<Surreal> for Surreal
[src]
fn partial_cmp(&self, other: &Surreal) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Display for Surreal
[src]
impl Debug for Surreal
[src]
impl<'a, 'b> Div<&'b Surreal> for &'a Surreal
[src]
Note: Currently, division does not work for numbers created on or after day 4, i.e. numbers with 4 or more layers of nested sets.
Panics
Panics if the divisor is zero. Panics if the quotient will have infinite sets.
type Output = Surreal
The resulting type after applying the /
operator.
fn div(self, other: &'b Surreal) -> Surreal
[src]
impl<'a, 'b> Sub<&'b Surreal> for &'a Surreal
[src]
type Output = Surreal
The resulting type after applying the -
operator.
fn sub(self, other: &'b Surreal) -> Surreal
[src]
impl<'a, 'b> Add<&'b Surreal> for &'a Surreal
[src]
type Output = Surreal
The resulting type after applying the +
operator.
fn add(self, other: &'b Surreal) -> Surreal
[src]
impl<'a, 'b> Mul<&'b Surreal> for &'a Surreal
[src]
Note: Currently, multiplication does not work for numbers created on or after day 4, i.e. numbers with 4 or more layers of nested sets.
type Output = Surreal
The resulting type after applying the *
operator.
fn mul(self, other: &'b Surreal) -> Surreal
[src]
impl<'a> Neg for &'a Surreal
[src]
Auto Trait Implementations
impl Send for Surreal
impl Sync for Surreal
impl Unpin for Surreal
impl UnwindSafe for Surreal
impl RefUnwindSafe for Surreal
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,