Skip to content

Commit 693d655

Browse files
committed
---
yaml --- r: 64658 b: refs/heads/snap-stage3 c: 037a5b1 h: refs/heads/master v: v3
1 parent 4801a0d commit 693d655

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2dd3c44a566537ef3f45e62e04148d61ab3cfd85
4+
refs/heads/snap-stage3: 037a5b1af4b66e44d6d2130cedb576c5659bac8c
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,6 @@ pub trait StrSlice<'self> {
11921192
fn subslice_offset(&self, inner: &str) -> uint;
11931193
11941194
fn as_imm_buf<T>(&self, f: &fn(*u8, uint) -> T) -> T;
1195-
fn as_mut_buf<T>(&self, f: &fn(*mut u8, uint) -> T) -> T;
11961195
fn as_c_str<T>(&self, f: &fn(*libc::c_char) -> T) -> T;
11971196
}
11981197
@@ -1965,23 +1964,6 @@ impl<'self> StrSlice<'self> for &'self str {
19651964
}
19661965
}
19671966
1968-
/**
1969-
* Work with the byte buffer and length of a slice.
1970-
*
1971-
* The given length is one byte longer than the 'official' indexable
1972-
* length of the string. This is to permit probing the byte past the
1973-
* indexable area for a null byte, as is the case in slices pointing
1974-
* to full strings, or suffixes of them.
1975-
*/
1976-
#[inline]
1977-
fn as_mut_buf<T>(&self, f: &fn(*mut u8, uint) -> T) -> T {
1978-
unsafe {
1979-
let v: *(*mut u8, uint) = cast::transmute(self);
1980-
let (buf, len) = *v;
1981-
f(buf, len)
1982-
}
1983-
}
1984-
19851967
/**
19861968
* Work with the byte buffer of a string as a null-terminated C string.
19871969
*
@@ -2056,6 +2038,18 @@ pub trait OwnedStr {
20562038
fn reserve_at_least(&mut self, n: uint);
20572039
fn capacity(&self) -> uint;
20582040
fn to_bytes_with_null(self) -> ~[u8];
2041+
2042+
/**
2043+
* Work with the mutable byte buffer and length of a slice.
2044+
*
2045+
* The given length is one byte longer than the 'official' indexable
2046+
* length of the string. This is to permit probing the byte past the
2047+
* indexable area for a null byte, as is the case in slices pointing
2048+
* to full strings, or suffixes of them.
2049+
*
2050+
* Make sure any mutations to this buffer keep this string valid UTF8.
2051+
*/
2052+
fn as_mut_buf<T>(&mut self, f: &fn(*mut u8, uint) -> T) -> T;
20592053
}
20602054
20612055
impl OwnedStr for ~str {
@@ -2246,6 +2240,12 @@ impl OwnedStr for ~str {
22462240
fn to_bytes_with_null(self) -> ~[u8] {
22472241
unsafe { ::cast::transmute(self) }
22482242
}
2243+
2244+
#[inline]
2245+
fn as_mut_buf<T>(&mut self, f: &fn(*mut u8, uint) -> T) -> T {
2246+
let v: &mut ~[u8] = unsafe { cast::transmute(self) };
2247+
v.as_mut_buf(f)
2248+
}
22492249
}
22502250
22512251
impl Clone for ~str {

0 commit comments

Comments
 (0)