about summary refs log tree commit diff
path: root/src/libstd/str.rs
AgeCommit message (Collapse)AuthorLines
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-169/+169
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-5/+5
2013-11-04docs: Replace std::iterator with std::iter.Huon Wilson-7/+7
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-1/+0
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Remove rt::io::supportAlex Crichton-48/+0
This removes the PathLike trait associated with this "support module". This is yet another "container of bytes" trait, so I didn't want to duplicate what already exists throughout libstd. In actuality, we're going to pass of C strings to the libuv APIs, so instead the arguments are now bound with the 'ToCStr' trait instead. Additionally, a layer of complexity was removed by immediately converting these type-generic parameters into CStrings to get handed off to libuv apis.
2013-10-23Removed the unnecesary commentsreedlepee-1/+0
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-7/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-2/+8
2013-10-23Don't Make str field privatereedlepee-0/+1
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-6/+6
Who doesn't like a massive renaming?
2013-10-17Fix starts_with() and ends_with().Jack Moffitt-2/+6
d4a32386f3b6 broke these since slice_to() and slice_from() must get character boundaries, and arbitrary needle lengths don't necessarily map to character boundaries of the haystack. This also adds new tests that would have caught this bug.
2013-10-16Rewrite str.starts_with()/ends_with() to be simplerKevin Ballard-19/+6
2013-10-15Require module documentation with missing_docAlex Crichton-0/+1
Closes #9824
2013-10-09option: rewrite the API to use compositionDaniel Micay-3/+3
2013-10-04auto merge of #9727 : Valloric/rust/doc-fixes, r=catamorphismbors-1/+1
2013-10-04Fixed another minor typo in std::str docsStrahinja Val Markovic-1/+1
2013-10-04Fix minor typo in std::str module docsStrahinja Val Markovic-1/+1
2013-10-02Add an implementation of FromStr for ~str and @strFlorian Gilcher-1/+21
This fixes an issue for APIs that return FromStr. Before this change, they would have to offer a seperate function for returning the source string.
2013-09-30std: Remove usage of fmt!Alex Crichton-14/+14
2013-09-27auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestingerbors-1/+1
The 0.8 release was cut, down with printf!
2013-09-26std: removed some warnings in tests.Erick Tryzelaar-1/+1
2013-09-26Update the compiler to not use printf/printflnAlex Crichton-1/+1
2013-09-26Moved StrSlice doc comments from impl to trait.Marvin Löbel-336/+410
Moved OwnedStr doc comments from impl to trait. Added a few #[inline] hints. The doc comment changes make the source a bit harder to read, as documentation and implementation no longer live right next to each other. But this way they at least appear in the docs.
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-26/+26
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-24Do not imply that str is sometimes null-terminated.Simon Sapin-2/+2
2013-09-20auto merge of #9276 : alexcrichton/rust/dox, r=brsonbors-6/+80
Hopefull this will make our libstd docs appear a little more "full".
2013-09-17std: Fix an invalid read in from_c_multistringBrian Anderson-2/+2
When `count` is `Some` this function was reading a byte past the end of the buffer.
2013-09-17Document a few undocumented modules in libstdAlex Crichton-6/+80
Hopefull this will make our libstd docs appear a little more "full".
2013-09-16std: merge conflict cleanup from std::strJeff Olson-1/+0
2013-09-16std: more work on from_c_multistring.. let it take an optional len paramJeff Olson-5/+17
2013-09-16std: win32 os::env() str parsing to str::raw::from_c_multistring + testJeff Olson-0/+37
2013-09-16auto merge of #9108 : blake2-ppc/rust/hazards-on-overflow, r=alexcrichtonbors-105/+78
Fix uint overflow bugs in std::{at_vec, vec, str} Closes #8742 Fix issue #8742, which summarized is: unsafe code in vec and str did assume that a reservation for `X + Y` elements always succeeded, and didn't overflow. Introduce the method `Vec::reserve_additional(n)` to make it easy to check for overflow in `Vec::push` and `Vec::push_all`. In std::str, simplify and remove a lot of the unsafe code and use `push_str` instead. With improvements to `.push_str` and the new function `vec::bytes::push_bytes`, it looks like this change has either no or positive impact on performance. I believe there are many places still where `v.reserve(A + B)` still can overflow. This by itself is not an issue unless followed by (unsafe) code that steps aside boundary checks.
2013-09-17std::str: Fix overflow problems in unsafe codeblake2-ppc-105/+59
See issue #8742
2013-09-16std::str: Add bench tests for StrVector::connect() and for str::push_strblake2-ppc-0/+19
2013-09-16Add an SendStr typeMarvin Löbel-1/+16
A SendStr is a string that can hold either a ~str or a &'static str. This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known. Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries. SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings. Replaced std::rt:logging::SendableString with SendStr Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-8/+8
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-05auto merge of #8997 : fhahn/rust/issue_8985, r=catamorphism,brsonbors-48/+48
Patch for #8985
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-48/+48
2013-09-05str: rm `map_chars`, replaced by iteratorsDaniel Micay-11/+0
mapping a function against the elements should not require allocating a new container, but `collect` still provides the functionality as-needed
2013-09-04std::str: Deny surrogates in is_utf8blake2-ppc-3/+12
Reject codepoints \uD800 to \uDFFF which are the surrogates (reserved/unused codepoints that are invalid to encode into UTF-8) The surrogates is the only hole of invalid codepoints in the range from \u0 to \u10FFFF.
2013-09-04auto merge of #8977 : pnkfelix/rust/fsk-followup-on-6009-rebased, r=alexcrichtonbors-1/+1
Fix #6009. Rebased version of #8970. Inherits review from alexcrichton.
2013-09-04stop treating char as an integer typeDaniel Micay-38/+8
Closes #7609
2013-09-04Added explicit pub to several conditions. Enables completion of #6009.Felix S. Klock II-1/+1
2013-09-03auto merge of #8884 : blake2-ppc/rust/exact-size-hint, r=huonwbors-15/+6
The message of the first commit explains (edited for changed trait name): The trait `ExactSize` is introduced to solve a few small niggles: * We can't reverse (`.invert()`) an enumeration iterator * for a vector, we have `v.iter().position(f)` but `v.rposition(f)`. * We can't reverse `Zip` even if both iterators are from vectors `ExactSize` is an empty trait that is intended to indicate that an iterator, for example `VecIterator`, knows its exact finite size and reports it correctly using `.size_hint()`. Only adaptors that preserve this at all times, can expose this trait further. (Where here we say finite for fitting in uint). --- It may seem complicated just to solve these small "niggles", (It's really the reversible enumerate case that's the most interesting) but only a few core iterators need to implement this trait. While we gain more capabilities generically for some iterators, it becomes a tad more complicated to figure out if a type has the right trait impls for it.
2013-09-01std::iterator: Use ExactSize, inheriting DoubleEndedIteratorblake2-ppc-1/+1
Address discussion with acrichto; inherit DoubleEndedIterator so that `.rposition()` can be a default method, and that the nische of the trait is clear. Use assertions when using `.size_hint()` in reverse enumerate and `.rposition()`
2013-08-30remove several 'ne' methodsEric Martin-4/+0
2013-08-30std::str: Use reverse enumerate and .rpositionblake2-ppc-15/+6
Simplify code by using the reversibility of enumerate and use .rposition().
2013-08-30auto merge of #8858 : blake2-ppc/rust/small-bugs, r=alexcrichtonbors-16/+21
Fix a bug in `s.slice_chars(a, b)` that did not accept `a == s.len()`. Fix a bug in `!=` defined for DList. Also simplify NormalizationIterator to use the CharIterator directly instead of mimicing the iteration itself.
2013-08-30auto merge of #8857 : blake2-ppc/rust/std-str-remove, r=thestingerbors-40/+0
These are very easy to replace with methods on string slices, basically `.char_len()` and `.len()`. These are the replacement implementations I did to clean these functions up, but seeing this I propose removal: /// ... pub fn count_chars(s: &str, begin: uint, end: uint) -> uint { // .slice() checks the char boundaries s.slice(begin, end).char_len() } /// Counts the number of bytes taken by the first `n` chars in `s` /// starting from byte index `begin`. /// /// Fails if there are less than `n` chars past `begin` pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint { s.slice_from(begin).slice_chars(0, n).len() }
2013-08-29auto merge of #8842 : jfager/rust/remove-iter-module, r=pnkfelixbors-1/+1
Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question.