about summary refs log tree commit diff
path: root/src/libcore/prelude.rs
AgeCommit message (Collapse)AuthorLines
2013-05-10Move core::task::local_data to core::local_dataYoungsoo Son-0/+1
2013-05-07Remove Durable from the languageBrian Anderson-1/+1
2013-05-06Move FuzzyEq trait into core::cmp and rename it to 'ApproxEq'Brendan Zabarauskas-1/+1
2013-05-04Register snapshotsBrian Anderson-3/+0
2013-05-03auto merge of #6216 : Sodel-the-Vociferous/rust/dralston-6146, r=graydonbors-1/+1
cc #6146
2013-05-03Add core::cmp::Equiv to preludeDaniel Ralston-1/+1
2013-05-02libcore: Export core::from_str::FromStr from core::preludegifnksm-0/+1
2013-05-01Revert rename of Div to QuotBrendan Zabarauskas-1/+1
2013-04-29auto merge of #6110 : bjz/rust/numeric-traits, r=pcwaltonbors-2/+3
As discussed on issue #4819, I have created four new traits: `Algebraic`, `Trigonometric`, `Exponential` and `Hyperbolic`, and moved the appropriate methods into them from `Real`. ~~~rust pub trait Algebraic { fn pow(&self, n: Self) -> Self; fn sqrt(&self) -> Self; fn rsqrt(&self) -> Self; fn cbrt(&self) -> Self; fn hypot(&self, other: Self) -> Self; } pub trait Trigonometric { fn sin(&self) -> Self; fn cos(&self) -> Self; fn tan(&self) -> Self; fn asin(&self) -> Self; fn acos(&self) -> Self; fn atan(&self) -> Self; fn atan2(&self, other: Self) -> Self; } pub trait Exponential { fn exp(&self) -> Self; fn exp2(&self) -> Self; fn expm1(&self) -> Self; fn log(&self) -> Self; fn log2(&self) -> Self; fn log10(&self) -> Self; } pub trait Hyperbolic: Exponential { fn sinh(&self) -> Self; fn cosh(&self) -> Self; fn tanh(&self) -> Self; } ~~~ There was some discussion over whether we should shorten the names, for example `Trig` and `Exp`. No abbreviations have been agreed on yet, but this could be considered in the future. Additionally, `Integer::divisible_by` has been renamed to `Integer::is_multiple_of`.
2013-04-29Revert "Merge Exponential and Hyperbolic traits"Brendan Zabarauskas-1/+1
After discussions on IRC and #4819, we have decided to revert this change. This is due to the traits expressing different ideas and because hyperbolic functions are not trivially implementable from exponential functions for floating-point types.
2013-04-29Merge Exponential and Hyperbolic traitsBrendan Zabarauskas-1/+1
The Hyperbolic Functions are trivially implemented in terms of `exp`, so it's simpler to group them the Exponential trait. In the future these would have default implementations.
2013-04-29Move appropriate functions out of Real and into separate Algebraic, ↵Brendan Zabarauskas-2/+3
Trigonometric, Exponential and Hyperbolic traits
2013-04-28make way for a new iter moduleDaniel Micay-3/+5
2013-04-27Add Orderable traitBrendan Zabarauskas-1/+1
This is a temporary trait until we have default methods. We don't want to encumber all implementors of Ord by requiring them to implement these functions, but at the same time we want to be able to take advantage of the speed of the specific numeric functions (like the `fmin` and `fmax` intrinsics).
2013-04-26Combine PrimitiveInt, Int, and Uint traits into one single traitBrendan Zabarauskas-2/+1
Having three traits for primitive ints/uints seemed rather excessive. If users wish to specify between them they can simply combine Int with either the Signed and Unsigned traits. For example: fn foo<T: Int + Signed>() { … }
2013-04-26Add BitCount traitBrendan Zabarauskas-1/+1
2013-04-26Add Int, Uint and Float traits for primitive numbersBrendan Zabarauskas-0/+1
2013-04-26Add Bitwise, Bounded, Primitive, and PrimitiveInt traitsBrendan Zabarauskas-0/+2
2013-04-25Restore Round trait and move appropriate methods out of RealBrendan Zabarauskas-1/+1
2013-04-25Add Fractional, Real and RealExt traitsBrendan Zabarauskas-0/+1
2013-04-25Rename Natural to IntegerBrendan Zabarauskas-1/+2
'Natural' normally means 'positive integer' in mathematics. It is therefore strange to implement it on signed integer types. 'Integer' is probably a better choice.
2013-04-25Use #[cfg(not(stage0))] to exclude items from stage0Brendan Zabarauskas-3/+1
As requested on the mailing list: https://mail.mozilla.org/pipermail/rust-dev/2013-April/003713.html
2013-04-24Implement Natural traitBrendan Zabarauskas-1/+1
This adds the following methods to ints and uints: - div - modulo - div_mod - quot_rem - gcd - lcm - divisible_by - is_even - is_odd I have not implemented Natural for BigInt and BigUInt because they're a little over my head.
2013-04-24Implement Signed and Unsigned traits and remove related predicate functionsBrendan Zabarauskas-1/+1
2013-04-22auto merge of #5980 : Kimundi/rust/ascii-encoding, r=thestingerbors-1/+2
Added Ascii type to use for byte inputs that are known to contain Ascii only.
2013-04-22Moved ascii out of strMarvin Löbel-5/+1
Removed deriving Ord, which allowed to remove the stage markers
2013-04-22Rename Div operator trait to Quot and Modulo operator trait to RemBrendan Zabarauskas-0/+5
2013-04-20Added Ascii typeMarvin Löbel-1/+6
2013-04-19librustc: WIP patch for using the return value.Patrick Walton-1/+1
2013-04-19test: Rewrite nbody and spectralnorm shootout benchmarksPatrick Walton-1/+1
2013-04-14Restore Num traitBrendan Zabarauskas-1/+1
This restores the trait that was lost in 216e85fadf465c25fe7bc4a9f06f8162ec12b552. It will eventually be broken up into a more fine-grained trait hierarchy in the future once a design can be agreed upon.
2013-03-28libcore: Add `print` and `println` to the preludePatrick Walton-0/+4
2013-03-27add a TotalEq traitDaniel Micay-1/+1
2013-03-26core: Clarify prelude docs. #4556Brian Anderson-1/+1
2013-03-21Switched over substr and trim functions in str to be non-allocating, ↵Marvin Löbel-1/+1
temporary renamed them to better track use-sites
2013-03-20core: add Reader, Writer, ReaderUtil, WriterUtil to prelude. Close #4182.Graydon Hoare-0/+1
2013-03-14auto merge of #5369 : thestinger/rust/iter, r=z0w0bors-2/+3
This can eventually be implemented on other sequence containers like `deque` (it's missing `each` too at the moment).
2013-03-13add a trait for mutable iteratorsDaniel Micay-2/+3
2013-03-13core: Add spawn, stream and friends to prelude. #5299Brian Anderson-0/+4
2013-03-11core: Remove logging constantsBrian Anderson-15/+0
2013-03-08core: Remove the dvec moduleAlex Crichton-1/+0
2013-03-02auto merge of #5196 : thestinger/rust/ord, r=catamorphismbors-2/+2
This allows `TreeMap`/`TreeSet` to fully express their requirements and reduces the comparisons from ~1.5 per level to 1 which really helps for string keys. I also added `ReverseIter` to the prelude exports because I forgot when I originally added it.
2013-03-02treemap: reimplement using TotalOrdDaniel Micay-1/+1
2013-03-02add a TotalOrd traitDaniel Micay-1/+1
2013-03-01Rename core::private to core::unstable. #4743Brian Anderson-1/+1
2013-02-21core: Extract comm from pipes. #4742Brian Anderson-1/+1
2013-02-21Moved core::extfmt to core::private::extfmtMarvin Löbel-1/+0
Needs a snapshot to remove stage0 extfmt export in core
2013-02-14libcore: Move the numeric operations out of Num. r=brsonPatrick Walton-1/+1
Sadly I could not use trait inheritance due to a type parameter substitution bug.
2013-02-12auto merge of #4881 : bjz/rust/incoming, r=catamorphismbors-1/+1
2013-02-11Add NumCast trait for generic numeric type castsBrendan Zabarauskas-1/+1