Commit Graph

6 Commits

Author SHA1 Message Date
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