about summary refs log tree commit diff
path: root/src/libextra/hex.rs
AgeCommit message (Collapse)AuthorLines
2014-02-13Move base64 and hex from libextra to libserializeLiigo Zhuang-208/+0
2014-02-03extra: Fix tests with io_error usageAlex Crichton-1/+1
2014-01-31Fix minor doc typosVirgile Andreani-2/+2
2014-01-21[std::str] Rename from_utf8_owned_opt() to from_utf8_owned(), drop the old ↵Simon Sapin-1/+1
from_utf8_owned() behavior
2014-01-15Stop returning error strings in From{Base64,Hex}Steven Fackler-5/+22
An enum allows callers to deal with errors in a more reasonable way.
2013-12-23extra: Fix all code examplesAlex Crichton-3/+1
2013-12-11Make 'self lifetime illegal.Erik Price-2/+2
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-04std::str: remove from_utf8.Huon Wilson-2/+2
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-11-26test: Remove all remaining non-procedure uses of `do`.Patrick Walton-4/+4
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-1/+1
2013-10-01Migrate users of 'loop' to 'continue'Alex Crichton-1/+1
Closes #9467
2013-09-30extra: Remove usage of fmt!Alex Crichton-5/+5
2013-09-26Update the compiler to not use printf/printflnAlex Crichton-4/+4
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-4/+4
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-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-3/+3
2013-08-06Result::get -> Result::unwrapSteven Fackler-6/+6
2013-08-06Removed convenience encoding trait implsSteven Fackler-70/+22
Encoding should really only be done from [u8]<->str. The extra convenience implementations don't really have a place, especially since they're so trivial. Also improved error messages in FromBase64.
2013-08-06Removing space for NULL terminatorSteven Fackler-2/+1
String NULL terminators are going away soon, so we may as well get rid of this now so it doesn't rot.
2013-08-06ToBase64 and ToHex perf improvementsSteven Fackler-6/+8
The overhead of str::push_char is high enough to cripple the performance of these two functions. I've switched them to build the output in a ~[u8] and then convert to a string later. Since we know exactly the bytes going into the vector, we can use the unsafe version to avoid the is_utf8 check. I could have riced it further with vec::raw::get, but it only added ~10MB/s so I didn't think it was worth it. ToHex is still ~30% slower than FromHex, which is puzzling. Before: ``` test base64::test::from_base64 ... bench: 1000 ns/iter (+/- 349) = 204 MB/s test base64::test::to_base64 ... bench: 2390 ns/iter (+/- 1130) = 63 MB/s ... test hex::tests::bench_from_hex ... bench: 884 ns/iter (+/- 220) = 341 MB/s test hex::tests::bench_to_hex ... bench: 2453 ns/iter (+/- 919) = 61 MB/s ``` After: ``` test base64::test::from_base64 ... bench: 1271 ns/iter (+/- 600) = 160 MB/s test base64::test::to_base64 ... bench: 759 ns/iter (+/- 286) = 198 MB/s ... test hex::tests::bench_from_hex ... bench: 875 ns/iter (+/- 377) = 345 MB/s test hex::tests::bench_to_hex ... bench: 593 ns/iter (+/- 240) = 254 MB/s ```
2013-08-06Some minor hex changesSteven Fackler-6/+8
2013-08-06Added hexadecimal encoding moduleSteven Fackler-0/+238
FromHex ignores whitespace and parses either upper or lower case hex digits. ToHex outputs lower case hex digits with no whitespace. Unlike ToBase64, ToHex doesn't allow you to configure the output format. I don't feel that it's super useful in this case.