summary refs log tree commit diff
path: root/src/libcore/str.rs
AgeCommit message (Collapse)AuthorLines
2013-03-31Fix underflow in char_range_at_reverseMarvin Löbel-2/+15
Added char_range_at_reverse underflow test
2013-03-29librustc: Remove `fail_unless!`Patrick Walton-307/+307
2013-03-28Removing unused importsAlex Crichton-2/+2
2013-03-28Unbreak 'rustc --help'Marvin Löbel-1/+2
2013-03-27add a TotalEq traitDaniel Micay-1/+25
2013-03-26librustc: Remove obsolete syntaxPatrick Walton-16/+42
2013-03-26librustc: Modify all code to use new lifetime binder syntaxPatrick Walton-37/+49
2013-03-26libcore: Change `[const T]` to `const [T]` everywherePatrick Walton-3/+3
2013-03-26Added more missing lifetime annotationsMarvin Löbel-8/+8
2013-03-26Added missing lifetime annotations, doc and whitespace cleanupsMarvin Löbel-66/+66
2013-03-26Fixed all use sites and testsMarvin Löbel-137/+141
2013-03-26Isolated bug, static vector seems to behave differently than fixed sized oneMarvin Löbel-30/+0
2013-03-26Switched over a bunch of splitting funktions to non-allocating iteratorsMarvin Löbel-53/+61
2013-03-26pre-rebase commitMarvin Löbel-99/+102
2013-03-26Moved float str buffer constants to the strconv moduleMarvin Löbel-8/+0
2013-03-25libcore: implement `str::each_char_reverse` correctly.Huon Wilson-10/+9
Previously, `each_char_reverse` was not iterating at all, so the testcase never ran properly.
2013-03-22librustc: Remove the `const` declaration form everywherePatrick Walton-18/+18
2013-03-22librustdoc: Remove `pure` from fuzzer and rustdoc.Patrick Walton-1/+1
2013-03-22libcore: Remove `pure` from libcore. rs=depurePatrick Walton-216/+216
2013-03-22auto merge of #5398 : dbaupp/rust/core-readlines, r=graydonbors-26/+92
The `each_line` function in `ReaderUtil` acts very differently to equivalent functions in Python, Ruby, Clojure etc. E.g. given a file `t` with contents `trailing\nnew line\n` and `n` containing `no trailing\nnew line`: Rust: ```Rust t: ~[~"trailing", ~"new line", ~""] n: ~[~"no trailing", ~"new line"] ``` Python: ```Python >>> open('t').readlines() ['trailing\n', 'new line\n'] >>> open('n').readlines() ['no trailing\n', 'new line'] ``` Ruby: ```Ruby irb(main):001:0> File.readlines('t') => ["trailing\n", "new line\n"] irb(main):002:0> File.readlines('n') => ["no trailing\n", "new line"] ``` Clojure ```Clojure user=> (read-lines "t") ("trailing" "new line") user=> (read-lines "n") ("no trailing" "new line") ``` The extra string that rust includes at the end is inconsistent, and means that it is impossible to distinguish between the "real" empty line a file that ends `...\n\n`, and the "fake" one after the last `\n`. The code attached makes Rust's `each_line` act like Clojure (and PHP, i.e. not including the `\n`), as well as adjusting `str::lines` to fix the trailing empty line problem. Also, add a convenience `read_lines` method to read all the lines in a file into a vector.
2013-03-23libcore: handle trailing newlines more like other languages.Huon Wilson-26/+92
Specifically, `lines` and `each_line` will not emit a trailing empty string when given "...\n". Also, add `read_lines`, which just collects all of `each_line` into a vector, and `split_*_no_trailing` which will is the generalised version of `lines`.
2013-03-21core: fix a typo in levdistanceErick Tryzelaar-2/+2
2013-03-21Un-renamed trim and substr functions.Marvin Löbel-58/+58
2013-03-21Switched over substr and trim functions in str to be non-allocating, ↵Marvin Löbel-87/+99
temporary renamed them to better track use-sites
2013-03-21back-renamed slice_DBG_BRWD, slice_V_DBG_BRWD -> slice, slice_DBG_UNIQ -> ↵Marvin Löbel-48/+48
slice_unique
2013-03-21removed str::slice_DBG_UNIQMarvin Löbel-66/+42
2013-03-21renamed str::view -> slice_DBG_BRWDMarvin Löbel-54/+66
renamed str::slice -> slice_DBG_UNIQ changed vec slice method -> to_owned() renamed vec view method -> slice_V_DBG_BRWD
2013-03-20core: add str::each{,i}_reverseErick Tryzelaar-76/+214
2013-03-20core: add char_len methodErick Tryzelaar-1/+5
2013-03-20core: add char_at_reverseErick Tryzelaar-1/+34
2013-03-18librustc: Convert all uses of old lifetime notation to new lifetime ↵Patrick Walton-35/+35
notation. rs=delifetiming
2013-03-15auto merge of #5404 : bstrie/rust/decopy, r=pcwaltonbors-0/+8
Also turn `copy` into `.clone()` in much of run-pass.
2013-03-15impl Clone for ~T, ~[T], ~strBen Striegel-0/+8
2013-03-14core: Add to_bytes method to StrSlice traitBrian Anderson-0/+3
2013-03-11Remove uses of logBrian Anderson-5/+4
2013-03-11libsyntax: Stop parsing bare functions in preparation for switching them overPatrick Walton-3/+9
2013-03-11librustc: Replace all uses of `fn()` with `&fn()`. rs=defunPatrick Walton-47/+47
2013-03-07test: Fix tests.Patrick Walton-10/+19
2013-03-07librustc: Convert all uses of `assert` over to `fail_unless!`Patrick Walton-366/+370
2013-03-06Add manual &self/ and &static/ and /&self declarations thatNiko Matsakis-6/+6
are currently inferred. New rules are coming that will require them to be explicit. All add some explicit self declarations.
2013-03-05auto merge of #5234 : pcwalton/rust/equiv, r=pcwaltonbors-1/+7
r? @nikomatsakis
2013-03-05libcore: Implement an `Equiv` trait and use it on hashmaps.Patrick Walton-1/+7
7.3x speedup in string map search speed on a microbenchmark of pure hashmap searching against a constant string, due to the lack of allocations. I ran into a few snags. 1. The way the coherence check is set up, I can't implement `Equiv<@str>` and `Equiv<~str>` for `&str` simultaneously. 2. I wanted to implement `Equiv<T>` for all `T:Eq` (i.e. every type can be compared to itself if it implements `Eq`), but the coherence check didn't like that either. 3. I couldn't add this to the `Map` trait because `LinearMap` needs special handling for its `Q` type parameter: it must not only implement `Equiv<T>` but also `Hash` and `Eq`. 4. `find_equiv(&&"foo")` doesn't parse, because of the double ampersand. It has to be written `find_equiv(& &"foo")`. We can probably just fix this. Nevertheless, this is a huge win; it should address a major source of performance problems, including the one here: http://maniagnosis.crsr.net/2013/02/creating-letterpress-cheating-program.html
2013-03-05auto merge of #5233 : bstrie/rust/deimpselfcore, r=graydonbors-65/+79
2013-03-04De-implicit-self libcoreBen Striegel-65/+79
2013-03-04Adding missing imports for tests, and gate off othersAlex Crichton-1/+3
2013-03-04Remove unused imports throughout src/Alex Crichton-3/+0
2013-03-02auto merge of #5196 : thestinger/rust/ord, r=catamorphismbors-1/+39
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-02add a TotalOrd traitDaniel Micay-1/+39
2013-02-28core: Address XXX, make static constants for strings used when stringifying ↵Tim Chevalier-0/+7
floats
2013-02-28Fix implicit leaks of imports throughout librariesAlex Crichton-0/+1
Also touch up use of 'pub' and move some tests around so the tested functions don't have to be 'pub'