File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: dcbeebc801e071394874843e0e4c7509a0fb46c1
2
+ refs/heads/master: 83e7c869bdfadf0ed8aca92e76fc5073b63402e2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5
5
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
Original file line number Diff line number Diff line change @@ -1768,6 +1768,7 @@ mod unsafe {
1768
1768
export
1769
1769
from_buf,
1770
1770
from_buf_len,
1771
+ from_buf_len_nocopy,
1771
1772
from_c_str,
1772
1773
from_c_str_len,
1773
1774
from_bytes,
@@ -1799,6 +1800,13 @@ mod unsafe {
1799
1800
return :: unsafe:: transmute ( v) ;
1800
1801
}
1801
1802
1803
+ /// Create a Rust string from a *u8 buffer of the given length without copying
1804
+ unsafe fn from_buf_len_nocopy ( buf : & a / * u8 , len : uint ) -> & a / str {
1805
+ let v = ( * buf, len + 1 ) ;
1806
+ assert is_utf8( :: unsafe:: reinterpret_cast ( v) ) ;
1807
+ return :: unsafe:: transmute ( v) ;
1808
+ }
1809
+
1802
1810
/// Create a Rust string from a null-terminated C string
1803
1811
unsafe fn from_c_str ( c_str : * libc:: c_char ) -> ~str {
1804
1812
from_buf ( :: unsafe:: reinterpret_cast ( c_str) )
You can’t perform that action at this time.
0 commit comments