about summary refs log tree commit diff
path: root/src/libcore/to_bytes.rs
blob: 6a5558e02365e83359233549c4265680867f3ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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::to_bytes(self) }
}

impl @(~str): ToBytes {
    fn to_bytes() -> ~[u8] { str::to_bytes(*self) }
}