about summary refs log tree commit diff
path: root/src/libstd/ascii.rs
AgeCommit message (Collapse)AuthorLines
2014-05-25auto merge of #14415 : Sawyer47/rust/ascii-fixme, r=huonwbors-5/+2
Issue #5475 was closed some time ago, but ascii.rs still contained a FIXME for it.
2014-05-25Fix FIXME #5475 in std::asciiPiotr Jawniak-5/+2
Issue #5475 was closed some time ago, but ascii.rs still contained a FIXME for it.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-15/+15
[breaking-change]
2014-05-24Rename functions in AsciiAdolfo Ochagavía-6/+48
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait. * Renamed `to_lower` to `to_lowercase` * Renamed `to_upper` to `to_uppercase` * Renamed `is_alpha` to `is_alphabetic` * Renamed `is_alnum` to `is_alphanumeric` * Renamed `is_lower` to `is_lowercase` * Renamed `is_upper` to `is_uppercase` [breaking-change]
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-3/+3
[breaking-change]
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-2/+2
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-59/+64
2014-05-11core: Remove the cast moduleAlex Crichton-16/+16
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-08Handle breakage after libcore splitKevin Ballard-1/+1
API Changes: - &[T] and ~[T] no longer support the addition operator (+)
2014-05-08Handle fallout in std::ascii and std::strconvKevin Ballard-36/+49
API changes: - OwnedAsciiCast returns Vec<Ascii> instead of ~[Ascii] - OwnedAsciiCast is implemented on Vec<u8> - AsciiStr.to_lower/upper() returns Vec<Ascii> - IntoBytes::into_bytes() returns Vec<u8> - float_to_str_bytes_common() returns (Vec<u8>, bool)
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-6/+6
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-27/+31
2014-04-02Fix fallout of requiring uint indicesAlex Crichton-7/+11
2014-03-31std: Switch field privacy as necessaryAlex Crichton-1/+1
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-2/+2
2014-03-23iter: remove `to_owned_vec`Daniel Micay-1/+1
This needs to be removed as part of removing `~[T]`. Partial type hints are now allowed, and will remove the need to add a version of this method for `Vec<T>`. For now, this involves a few workarounds for partial type hints not completely working.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-2/+2
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-1/+1
Closes #12702
2014-03-18Add impl IntoStr for ::std::vec_ng::Vec<Ascii>Eunchong Yu-0/+26
2014-02-28std: Change assert_eq!() to use {} instead of {:?}Alex Crichton-1/+1
Formatting via reflection has been a little questionable for some time now, and it's a little unfortunate that one of the standard macros will silently use reflection when you weren't expecting it. This adds small bits of code bloat to libraries, as well as not always being necessary. In light of this information, this commit switches assert_eq!() to using {} in the error message instead of {:?}. In updating existing code, there were a few error cases that I encountered: * It's impossible to define Show for [T, ..N]. I think DST will alleviate this because we can define Show for [T]. * A few types here and there just needed a #[deriving(Show)] * Type parameters needed a Show bound, I often moved this to `assert!(a == b)` * `Path` doesn't implement `Show`, so assert_eq!() cannot be used on two paths. I don't think this is much of a regression though because {:?} on paths looks awful (it's a byte array). Concretely speaking, this shaved 10K off a 656K binary. Not a lot, but sometime significant for smaller binaries.
2014-02-24replace manual Hash impls with `#[deriving(Hash)]`Erick Tryzelaar-9/+1
2014-02-23Remove all ToStr impls, add Show implsAlex Crichton-9/+1
This commit changes the ToStr trait to: impl<T: fmt::Show> ToStr for T { fn to_str(&self) -> ~str { format!("{}", *self) } } The ToStr trait has been on the chopping block for quite awhile now, and this is the final nail in its coffin. The trait and the corresponding method are not being removed as part of this commit, but rather any implementations of the `ToStr` trait are being forbidden because of the generic impl. The new way to get the `to_str()` method to work is to implement `fmt::Show`. Formatting into a `&mut Writer` (as `format!` does) is much more efficient than `ToStr` when building up large strings. The `ToStr` trait forces many intermediate allocations to be made while the `fmt::Show` trait allows incremental buildup in the same heap allocated buffer. Additionally, the `fmt::Show` trait is much more extensible in terms of interoperation with other `Writer` instances and in more situations. By design the `ToStr` trait requires at least one allocation whereas the `fmt::Show` trait does not require any allocations. Closes #8242 Closes #9806
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-4/+4
2014-02-13Add some missing Show implementations in libstdBrendan Zabarauskas-1/+12
2014-02-07Cleaned up imports per coding standards.chromatic-3/+3
No functional changes; just style.
2014-02-07Removed prelude::* from libstd files.chromatic-2/+2
This replaces the imports from the prelude with the re-exported symbols.
2014-01-31Fix minor doc typosVirgile Andreani-5/+5
2014-01-15Issue #3511 - Rationalize temporary lifetimes.Niko Matsakis-4/+9
Major changes: - Define temporary scopes in a syntax-based way that basically defaults to the innermost statement or conditional block, except for in a `let` initializer, where we default to the innermost block. Rules are documented in the code, but not in the manual (yet). See new test run-pass/cleanup-value-scopes.rs for examples. - Refactors Datum to better define cleanup roles. - Refactor cleanup scopes to not be tied to basic blocks, permitting us to have a very large number of scopes (one per AST node). - Introduce nascent documentation in trans/doc.rs covering datums and cleanup in a more comprehensive way.
2014-01-07stdtest: Fix all leaked trait importsAlex Crichton-1/+1
2014-01-05Fix some warningsCorey Richardson-0/+1
2014-01-02auto merge of #10828 : SimonSapin/rust/ascii_opt, r=pcwaltonbors-36/+70
… instead of failing. Make them default methods on the trait, and also make .to_ascii() a default method while we’re at it.
2013-12-27std: uniform modules titles for docLuca Bruno-1/+1
This commit uniforms the short title of modules provided by libstd, in order to make their roles more explicit when glancing at the index. Signed-off-by: Luca Bruno <lucab@debian.org>
2013-12-23[std::ascii] Add .to_ascii_opt() and .into_ascii_opt() returning OptionSimon Sapin-36/+70
… instead of failing. Make them default methods on the trait, and also make .to_ascii() a default method while we’re at it. Conflicts: src/libstd/ascii.rs
2013-12-15Rename To{Str,Bytes}Consume traits to Into*.Chris Morgan-4/+4
That is: - `ToStrConsume` → `IntoStr`; - `ToBytesConsume` → `IntoBytes`.
2013-12-11Make 'self lifetime illegal.Erik Price-8/+8
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-11-27std::ascii: Add tests for is_digit() and is_control()Eric Biggers-0/+9
2013-11-26std::ascii: Fix is_digit() and is_control()Eric Biggers-2/+2
is_digit() incorrectly returned false for '0'. is_control() incorrectly returned true for ' ' (space).
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-1/+1
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-4/+4
2013-11-23Add ctype-likes to AsciiCorey Richardson-0/+68
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-1/+1
2013-11-08std::ascii: Provide a copyless [Ascii] -> str method.Huon Wilson-15/+18
This renames to_str_ascii to as_str_ascii and makes it non-copying, which is possible now that strings no longer have a hidden extra byte/null terminator. Fixes #6120.
2013-11-03Rename files to match current recommendations.Chris Morgan-0/+582
New standards have arisen in recent months, mostly for the use of rustpkg, but the main Rust codebase has not been altered to match these new specifications. This changeset rectifies most of these issues. - Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for consistency with current styles; this affects extra, rustc, rustdoc, rustpkg, rustuv, std, syntax. - Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for `std::num` and `std::terminfo`. - Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str` directory, to be consistent with its import path of `std::ascii`; libstd is flat at present so it's more appropriate thus. While this removes some `#[path = "..."]` directives, it does not remove all of them, and leaves certain other inconsistencies, such as `std::u8` et al. which are actually stored in `src/libstd/num/` (one subdirectory down). No quorum has been reached on this issue, so I felt it best to leave them all alone at present. #9208 deals with the possibility of making libstd more hierarchical (such as changing the crate to match the current filesystem structure, which would make the module path `std::num::u8`). There is one thing remaining in which this repository is not rustpkg-compliant: rustpkg would have `src/std/` et al. rather than `src/libstd/` et al. I have not endeavoured to change that at this point as it would guarantee prompt bitrot and confusion. A change of that magnitude needs to be discussed first.