about summary refs log tree commit diff
path: root/src/libserialize/base64.rs
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2014-05-14 16:55:24 -0700
committerKevin Ballard <kevin@sb.org>2014-05-14 17:35:55 -0700
commitba7844a7fff0061e5b4528c2ecd5adf765145b70 (patch)
treebf1998a94512013b15d5216388b1d99db7b54935 /src/libserialize/base64.rs
parentd0f3cb05df41b14b58553fab6a533e0e4c947b06 (diff)
Change StrBuf::from_utf8() to return Result
This allows the original vector to be recovered in the event that it is
not UTF-8.

[breaking-change]
Diffstat (limited to 'src/libserialize/base64.rs')
-rw-r--r--src/libserialize/base64.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs
index 4709365ebff..5702557526f 100644
--- a/src/libserialize/base64.rs
+++ b/src/libserialize/base64.rs
@@ -181,9 +181,8 @@ impl<'a> FromBase64 for &'a str {
      * Convert any base64 encoded string (literal, `@`, `&`, or `~`)
      * to the byte values it encodes.
      *
-     * You can use the `from_utf8_owned` function in `std::str`
-     * to turn a `[u8]` into a string with characters corresponding to those
-     * values.
+     * You can use the `StrBuf::from_utf8` function in `std::strbuf` to turn a
+     * `Vec<u8>` into a string with characters corresponding to those values.
      *
      * # Example
      *
@@ -199,7 +198,7 @@ impl<'a> FromBase64 for &'a str {
      *     let res = hello_str.from_base64();
      *     if res.is_ok() {
      *       let opt_bytes = StrBuf::from_utf8(res.unwrap());
-     *       if opt_bytes.is_some() {
+     *       if opt_bytes.is_ok() {
      *         println!("decoded from base64: {}", opt_bytes.unwrap());
      *       }
      *     }