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).
This commit is contained in:
parent
ba4a4778cc
commit
efc71a8bdb
44 changed files with 255 additions and 218 deletions
|
|
@ -44,8 +44,7 @@ pub fn normalize(p_: RemotePath) -> LocalPath {
|
|||
}
|
||||
|
||||
pub fn write<W: Writer>(writer: &mut W, string: &str) {
|
||||
let buffer = str::as_bytes_slice(string);
|
||||
writer.write(buffer);
|
||||
writer.write(string.as_bytes());
|
||||
}
|
||||
|
||||
pub fn hash(data: ~str) -> ~str {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue