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