2012-07-31 12:27:51 -05:00
|
|
|
trait to_bytes {
|
2012-07-03 23:30:09 -05:00
|
|
|
fn to_bytes() -> ~[u8];
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl ~[u8]: to_bytes {
|
2012-07-03 23:30:09 -05:00
|
|
|
fn to_bytes() -> ~[u8] { copy self }
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl @~[u8]: to_bytes {
|
2012-07-03 23:30:09 -05:00
|
|
|
fn to_bytes() -> ~[u8] { copy *self }
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl ~str: to_bytes {
|
2012-07-03 23:30:09 -05:00
|
|
|
fn to_bytes() -> ~[u8] { str::bytes(self) }
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl @(~str): to_bytes {
|
2012-07-03 23:30:09 -05:00
|
|
|
fn to_bytes() -> ~[u8] { str::bytes(*self) }
|
|
|
|
}
|