From 516f1511f6ad62e00a59d102f503ac7e31260012 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Sat, 5 Oct 2019 21:01:58 +0200 Subject: [PATCH] Add `as_{,mut_}ptr` functions to `ArrayVec`, mirroring `Vec` Fixes #135. --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b7b7a54..e7e8151 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -643,6 +643,16 @@ impl ArrayVec { pub fn as_mut_slice(&mut self) -> &mut [A::Item] { self } + + /// Return a raw pointer to the vector's buffer. + pub fn as_ptr(&self) -> *const A::Item { + self.xs.ptr() + } + + /// Return a raw mutable pointer to the vector's buffer. + pub fn as_mut_ptr(&mut self) -> *mut A::Item { + self.xs.ptr_mut() + } } impl Deref for ArrayVec {