Document future intentions regarding the cast function.

This commit is contained in:
Brendan Zabarauskas 2012-12-04 14:56:06 +10:00
parent 54953a8f01
commit f9778adf17
2 changed files with 10 additions and 6 deletions

View file

@ -7,8 +7,8 @@ Lmath is generic linear algebra library for Rust. There is still much to do, uni
- ~~Matrix inversion~~
- ~~Matrix rotation~~
- ~~Angle types (degrees/radians)~~
- N x M matrices
- Operator Overloading
- Phase out the use of `num::cast::cast` for numeric conversions
- Implement component-wise functions for vectors
- Euler and axial rotations
- Performance improvements
@ -23,4 +23,4 @@ Dependant on rust/master:
- Make use of static functions for constants and constructors
~B☼
~B☼

View file

@ -1,10 +1,14 @@
/**
* This trait allows for the easy casting between each of thethe built in
* numeric types, going above and beyond the static 'to_int' function found in
* the Num trait. I've found that it is especially handy in generic functions
* when you need to mix floating point and integer values.
* Wrapper methods for numeric type casts
*
* Note: although the `from` and `cast` medods are still inclueded, they will
* be phased out in favour of the `num::kinds::Number::from<T:Number(n: T)`
* static constructor method. I feel that this will be far clearer than using
* the `cast` function everywhere.
*/
pub trait NumCast {
// TODO: the plan is to remove the `from` and `cast` methods and use the
// `num::kinds::Number::from<T:Number(n: T)` method instead
static pure fn from<T:NumCast>(n: T) -> self;
pure fn cast<T:NumCast>(&self) -> T;