Skip to content

Commit 516f151

Browse files
committed
Add as_{,mut_}ptr functions to ArrayVec, mirroring Vec
Fixes #135.
1 parent 8c3634a commit 516f151

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,16 @@ impl<A: Array> ArrayVec<A> {
643643
pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
644644
self
645645
}
646+
647+
/// Return a raw pointer to the vector's buffer.
648+
pub fn as_ptr(&self) -> *const A::Item {
649+
self.xs.ptr()
650+
}
651+
652+
/// Return a raw mutable pointer to the vector's buffer.
653+
pub fn as_mut_ptr(&mut self) -> *mut A::Item {
654+
self.xs.ptr_mut()
655+
}
646656
}
647657

648658
impl<A: Array> Deref for ArrayVec<A> {

0 commit comments

Comments
 (0)