rust/src/libcore/to_bytes.rs

24 lines
423 B
Rust
Raw Normal View History

2012-08-14 14:11:15 -05:00
// NB: transitionary, de-mode-ing.
#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
trait ToBytes {
fn to_bytes() -> ~[u8];
}
impl ~[u8]: ToBytes {
fn to_bytes() -> ~[u8] { copy self }
}
impl @~[u8]: ToBytes {
fn to_bytes() -> ~[u8] { copy *self }
}
impl ~str: ToBytes {
fn to_bytes() -> ~[u8] { str::bytes(self) }
}
impl @(~str): ToBytes {
fn to_bytes() -> ~[u8] { str::bytes(*self) }
}