Skip to content

Commit d3c6f2f

Browse files
committed
---
yaml --- r: 15593 b: refs/heads/try c: 43061f3 h: refs/heads/master i: 15591: 5b5ad53 v: v3
1 parent 2d65d05 commit d3c6f2f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 14d050969131b14dbf625865fb061e3fb7072a18
5+
refs/heads/try: 43061f3969d1d961bd4e4d57c06452ca80c1adb6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export
2020
as_bytes,
2121
as_buf,
2222
as_c_str,
23+
unpack_slice,
2324

2425
// Adding things to and removing things from a string
2526
push_char,

branches/try/src/libcore/vec.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export permute;
7171
export windowed;
7272
export as_buf;
7373
export as_mut_buf;
74+
export unpack_slice;
7475
export unsafe;
7576
export u8;
7677
export extensions;
@@ -954,6 +955,15 @@ fn as_mut_buf<E,T>(v: [mut E], f: fn(*mut E) -> T) -> T unsafe {
954955
let buf = unsafe::to_ptr(v) as *mut E; f(buf)
955956
}
956957

958+
#[doc = "
959+
Work with the buffer and length of a slice.
960+
"]
961+
fn unpack_slice<T,U>(s: [const T]/&, f: fn(*T, uint) -> U) -> U unsafe {
962+
let v : *(*T,uint) = ::unsafe::reinterpret_cast(ptr::addr_of(s));
963+
let (buf,len) = *v;
964+
f(buf, len / sys::size_of::<T>())
965+
}
966+
957967
#[doc = "Extension methods for vectors"]
958968
impl extensions<T> for [const T] {
959969
#[doc = "

0 commit comments

Comments
 (0)