Skip to content

Commit ba28000

Browse files
committed
---
yaml --- r: 21887 b: refs/heads/snap-stage3 c: e3f5403 h: refs/heads/master i: 21885: 8a5db53 21883: e1417c7 21879: 8e44252 21871: fa46c84 21855: 3120678 21823: 4adf690 21759: 96ba8da v: v3
1 parent cbd430f commit ba28000

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: d0d68c6036275c0a190ad100d6eb36a537b76d80
4+
refs/heads/snap-stage3: e3f5403052e53b557998315fae780b5431a8ce0b
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcore/str.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,10 +1967,10 @@ mod raw {
19671967
export
19681968
from_buf,
19691969
from_buf_len,
1970-
from_buf_len_nocopy,
19711970
from_c_str,
19721971
from_c_str_len,
19731972
from_bytes,
1973+
form_slice,
19741974
slice_bytes,
19751975
view_bytes,
19761976
push_byte,
@@ -2003,14 +2003,6 @@ mod raw {
20032003
return ::unsafe::transmute(move v);
20042004
}
20052005

2006-
/// Create a Rust string from a *u8 buffer of the given length
2007-
/// without copying
2008-
unsafe fn from_buf_len_nocopy(buf: &a / *u8, len: uint) -> &a / str {
2009-
let v = (*buf, len + 1);
2010-
assert is_utf8(::unsafe::reinterpret_cast(&v));
2011-
return ::unsafe::transmute(move v);
2012-
}
2013-
20142006
/// Create a Rust string from a null-terminated C string
20152007
unsafe fn from_c_str(c_str: *libc::c_char) -> ~str {
20162008
from_buf(::unsafe::reinterpret_cast(&c_str))
@@ -2031,6 +2023,13 @@ mod raw {
20312023
/// Converts a byte to a string.
20322024
unsafe fn from_byte(u: u8) -> ~str { raw::from_bytes([u]) }
20332025

2026+
/// Form a slice from a *u8 buffer of the given length without copying.
2027+
unsafe fn buf_as_slice<T>(buf: *u8, len: uint, f: fn(&& &str) -> T) -> T {
2028+
let v = (*buf, len + 1);
2029+
assert is_utf8(::unsafe::reinterpret_cast(&v));
2030+
f(::unsafe::transmute(move v))
2031+
}
2032+
20342033
/**
20352034
* Takes a bytewise (not UTF-8) slice from a string.
20362035
*

0 commit comments

Comments
 (0)