Commit Graph

18 Commits

Author SHA1 Message Date
Marvin Löbel
c1de0a0f9e Added a Pattern impl that delegates to the dereference of a type.
This allows to match with a `&String` or `&&str`, for example.
2015-02-20 00:58:06 +01:00
Marvin Löbel
f9ef8cd555 Refactored code into Searcher traits with naive implementations
Made the family of Split iterators use the Pattern API

Renamed the Matcher traits into Searcher
2015-02-20 00:57:38 +01:00
Marvin Löbel
54f0bead81 Added string pattern traits and basic implementantions 2015-02-20 00:32:59 +01:00
Marvin Löbel
d68eb3d248 Added benchmarks for string pattern matching functions 2015-02-20 00:32:59 +01:00
Jorge Aparicio
571cc7f8e9 remove all kind annotations from closures 2015-02-04 20:06:08 -05:00
Alex Crichton
0cdde6e5e0 std: Stabilize FromStr and parse
This commits adds an associated type to the `FromStr` trait representing an
error payload for parses which do not succeed. The previous return value,
`Option<Self>` did not allow for this form of payload. After the associated type
was added, the following attributes were applied:

* `FromStr` is now stable
* `FromStr::Err` is now stable
* `FromStr::from_str` is now stable
* `StrExt::parse` is now stable
* `FromStr for bool` is now stable
* `FromStr for $float` is now stable
* `FromStr for $integral` is now stable
* Errors returned from stable `FromStr` implementations are stable
* Errors implement `Display` and `Error` (both impl blocks being `#[stable]`)

Closes #15138
2015-01-30 08:52:44 -08:00
Jorge Aparicio
efc97a51ff convert remaining range(a, b) to a..b 2015-01-29 07:49:01 -05:00
Jorge Aparicio
bce81e2464 cleanup: s/v.slice*()/&v[a..b]/g + remove redundant as_slice() calls 2015-01-27 09:03:06 -05:00
Alex Crichton
7d8d06f86b Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
2015-01-03 23:43:57 -08:00
Alex Crichton
56290a0044 std: Stabilize the prelude module
This commit is an implementation of [RFC 503][rfc] which is a stabilization
story for the prelude. Most of the RFC was directly applied, removing reexports.
Some reexports are kept around, however:

* `range` remains until range syntax has landed to reduce churn.
* `Path` and `GenericPath` remain until path reform lands. This is done to
  prevent many imports of `GenericPath` which will soon be removed.
* All `io` traits remain until I/O reform lands so imports can be rewritten all
  at once to `std::io::prelude::*`.

This is a breaking change because many prelude reexports have been removed, and
the RFC can be consulted for the exact list of removed reexports, as well as to
find the locations of where to import them.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md
[breaking-change]

Closes #20068
2015-01-02 08:54:06 -08:00
Alex Crichton
082bfde412 Fallout of std::str stabilization 2014-12-21 23:31:42 -08:00
Jorge Aparicio
47acce498a libcoretest: fix fallout in unit tests 2014-12-13 17:03:45 -05:00
Simon Sapin
dff48a99d6 Add Utf16Encoder. Generalize Utf16CodeUnits for any Iterator<char>.
This allows encoding to UTF-16 something that is not in UTF-8, e.g. a
`[char]` UTF-32 string.

This might help with https://github.com/servo/servo/issues/4023
2014-11-20 14:05:28 +00:00
Brendan Zabarauskas
29bc9c632e Move FromStr to core::str 2014-11-16 12:41:55 +11:00
Alex Crichton
8e9f8f924c collections: impl Deref for Vec/String
This commit adds the following impls:

    impl<T> Deref<[T]> for Vec<T>
    impl<T> DerefMut<[T]> for Vec<T>
    impl Deref<str> for String

This commit also removes all duplicated inherent methods from vectors and
strings as implementations will now silently call through to the slice
implementation. Some breakage occurred at std and beneath due to inherent
methods removed in favor of those in the slice traits and std doesn't use its
own prelude,

cc #18424
2014-10-29 18:48:30 -07:00
nham
e9db8adebb core: Make TwoWaySearcher reset its prefix memory when shifting by byteset
Closes #16878.
2014-09-02 01:53:12 -04:00
nham
9419e92659 Fix TwoWaySearcher to work when used with periodic needles.
There is a check in TwoWaySearcher::new to determine whether the needle
is periodic. This is needed because during searching when a match fails,
we cannot advance the position by the entire length of the needle when
it is periodic, but can only advance by the length of the period.

The reason "bananas".contains("nana") (and similar searches) were
returning false was because the periodicity check was wrong.

Closes #16589
2014-08-20 02:51:22 -04:00
nham
3b0084e834 Add a test for the fix of issue 16589 2014-08-19 00:37:34 -04:00