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 81ecd27 commit 6e98416Copy full SHA for 6e98416
src/libcore/vec.rs
@@ -1420,6 +1420,11 @@ mod unsafe {
1420
data: u8
1421
};
1422
1423
+ type slice_repr = {
1424
+ mut data: *u8,
1425
+ mut len: uint
1426
+ };
1427
+
1428
/**
1429
* Constructs a vector from an unsafe pointer to a buffer
1430
*
@@ -1465,6 +1470,13 @@ mod unsafe {
1465
1470
}
1466
1471
1467
1472
1473
+ #[inline(always)]
1474
+ unsafe fn to_ptr_slice<T>(v: &[const T]) -> *T {
1475
+ let repr: **slice_repr = ::unsafe::reinterpret_cast(addr_of(v));
1476
+ ret ::unsafe::reinterpret_cast(addr_of((**repr).data));
1477
+ }
1478
1479
1468
1480
1469
1481
* Form a slice from a pointer and length (as a number of units,
1482
* not bytes).
0 commit comments