Move Complex struct to its own file
This commit is contained in:
parent
a60ec25c8e
commit
74f98379b9
2 changed files with 21 additions and 11 deletions
19
types/src/number/complex.rs
Normal file
19
types/src/number/complex.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/* types/src/number/complex.rs
|
||||||
|
* Eryn Wells <eryn@erynwells.me>
|
||||||
|
*/
|
||||||
|
|
||||||
|
use number::Real;
|
||||||
|
use value::*;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct Complex {
|
||||||
|
real: Real,
|
||||||
|
imag: Real
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IsBool for Complex { }
|
||||||
|
impl IsChar for Complex { }
|
||||||
|
|
||||||
|
impl IsNumber for Complex {
|
||||||
|
fn is_complex(&self) -> bool { true }
|
||||||
|
}
|
|
@ -7,9 +7,11 @@
|
||||||
/// Scheme numbers are complex, literally.
|
/// Scheme numbers are complex, literally.
|
||||||
|
|
||||||
pub mod real;
|
pub mod real;
|
||||||
|
pub mod complex;
|
||||||
mod add;
|
mod add;
|
||||||
|
|
||||||
pub use self::real::Real;
|
pub use self::real::Real;
|
||||||
|
pub use self::complex::Complex;
|
||||||
|
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
@ -46,14 +48,3 @@ impl ValueEq for Box<Number> {
|
||||||
}
|
}
|
||||||
fn as_any(&self) -> &Any { self }
|
fn as_any(&self) -> &Any { self }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
struct Complex {
|
|
||||||
real: Real,
|
|
||||||
imag: Real
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IsNumber for Complex {
|
|
||||||
fn is_complex(&self) -> bool { true }
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue