diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-11-06 11:25:09 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-11-06 13:08:24 -0500 |
| commit | 679eb9191dd06a2e0dacf3602da56765211fd76a (patch) | |
| tree | 5f54112030558429db3a1e1729faa5ef5b0da9ed /src/libserialize/base64.rs | |
| parent | 60a669a1743b845dfa349684ef057bc98ec6d840 (diff) | |
DTSify libserialize traits
- ToBase64 - FromBase64 - ToHex - FromHex - ToJson - Encodable
Diffstat (limited to 'src/libserialize/base64.rs')
| -rw-r--r-- | src/libserialize/base64.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index e69a0ea7929..f287fb99750 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -54,13 +54,13 @@ static URLSAFE_CHARS: &'static[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\ 0123456789-_"; /// A trait for converting a value to base64 encoding. -pub trait ToBase64 { +pub trait ToBase64 for Sized? { /// Converts the value of `self` to a base64 value following the specified /// format configuration, returning the owned string. fn to_base64(&self, config: Config) -> String; } -impl<'a> ToBase64 for &'a [u8] { +impl ToBase64 for [u8] { /** * Turn a vector of `u8` bytes into a base64 string. * @@ -155,7 +155,7 @@ impl<'a> ToBase64 for &'a [u8] { } /// A trait for converting from base64 encoded values. -pub trait FromBase64 { +pub trait FromBase64 for Sized? { /// Converts the value of `self`, interpreted as base64 encoded data, into /// an owned vector of bytes, returning the vector. fn from_base64(&self) -> Result<Vec<u8>, FromBase64Error>; @@ -192,7 +192,7 @@ impl error::Error for FromBase64Error { } } -impl<'a> FromBase64 for &'a str { +impl FromBase64 for str { /** * Convert any base64 encoded string (literal, `@`, `&`, or `~`) * to the byte values it encodes. @@ -227,7 +227,7 @@ impl<'a> FromBase64 for &'a str { } } -impl<'a> FromBase64 for &'a [u8] { +impl FromBase64 for [u8] { fn from_base64(&self) -> Result<Vec<u8>, FromBase64Error> { let mut r = Vec::new(); let mut buf: u32 = 0; |
