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