We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68704e4 commit c2f8cf9Copy full SHA for c2f8cf9
src/libcore/str.rs
@@ -24,6 +24,7 @@ export
24
25
// Reinterpretation
26
as_bytes,
27
+ as_bytes_slice,
28
as_buf,
29
as_c_str,
30
@@ -1751,6 +1752,10 @@ pure fn as_bytes<T>(s: ~str, f: fn(~[u8]) -> T) -> T {
1751
1752
}
1753
1754
1755
+pure fn as_bytes_slice(s: &a/str) -> &a/[u8] {
1756
+ unsafe { ::unsafe::reinterpret_cast(&s) }
1757
+}
1758
+
1759
/**
1760
* Work with the byte buffer of a string as a null-terminated C string.
1761
*
0 commit comments