diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-11 13:10:37 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-12 12:21:04 +1000 |
| commit | efc71a8bdb28fba88d0cc8916b33838bf43b3a8d (patch) | |
| tree | ad0086d4319facd8da21583e19a952a01250bbbd /src/libextra/ebml.rs | |
| parent | ba4a4778cc17c64c33a891a0d2565a1fb04ddffc (diff) | |
| download | rust-efc71a8bdb28fba88d0cc8916b33838bf43b3a8d.tar.gz rust-efc71a8bdb28fba88d0cc8916b33838bf43b3a8d.zip | |
std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
The first acts on &str and is not nul-terminated, the last two act on strings that are always null terminated (&'static str, ~str and @str).
Diffstat (limited to 'src/libextra/ebml.rs')
| -rw-r--r-- | src/libextra/ebml.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libextra/ebml.rs b/src/libextra/ebml.rs index 233c8042640..dd08f23a7a1 100644 --- a/src/libextra/ebml.rs +++ b/src/libextra/ebml.rs @@ -607,7 +607,6 @@ pub mod writer { use core::cast; use core::io; - use core::str; // ebml writing pub struct Encoder { @@ -725,7 +724,7 @@ pub mod writer { } pub fn wr_tagged_str(&mut self, tag_id: uint, v: &str) { - str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b)); + self.wr_tagged_bytes(tag_id, v.as_bytes()); } pub fn wr_bytes(&mut self, b: &[u8]) { @@ -735,7 +734,7 @@ pub mod writer { pub fn wr_str(&mut self, s: &str) { debug!("Write str: %?", s); - self.writer.write(str::to_bytes(s)); + self.writer.write(s.as_bytes()); } } |
