1
Fork 0
rust/src/libcore/to_bytes.rs

20 lines
333 B
Rust
Raw Normal View History

trait to_bytes {
fn to_bytes() -> ~[u8];
}
2012-08-07 18:10:06 -07:00
impl ~[u8]: to_bytes {
fn to_bytes() -> ~[u8] { copy self }
}
2012-08-07 18:10:06 -07:00
impl @~[u8]: to_bytes {
fn to_bytes() -> ~[u8] { copy *self }
}
2012-08-07 18:10:06 -07:00
impl ~str: to_bytes {
fn to_bytes() -> ~[u8] { str::bytes(self) }
}
2012-08-07 18:10:06 -07:00
impl @(~str): to_bytes {
fn to_bytes() -> ~[u8] { str::bytes(*self) }
}