mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-02 00:07:42 +03:00
20 lines
357 B
Rust
20 lines
357 B
Rust
trait to_bytes {
|
|
fn to_bytes() -> ~[u8];
|
|
}
|
|
|
|
impl of to_bytes for ~[u8] {
|
|
fn to_bytes() -> ~[u8] { copy self }
|
|
}
|
|
|
|
impl of to_bytes for @~[u8] {
|
|
fn to_bytes() -> ~[u8] { copy *self }
|
|
}
|
|
|
|
impl of to_bytes for ~str {
|
|
fn to_bytes() -> ~[u8] { str::bytes(self) }
|
|
}
|
|
|
|
impl of to_bytes for @(~str) {
|
|
fn to_bytes() -> ~[u8] { str::bytes(*self) }
|
|
}
|