Skip to content

Commit 0052bc9

Browse files
committed
Expose the underlying array in addition to a ptr to the same
1 parent a5147bb commit 0052bc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

secp256k1-sys/src/macros.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ macro_rules! impl_array_newtype {
3434
dat.as_mut_ptr()
3535
}
3636

37+
#[inline]
38+
/// Gets a reference to the underlying array
39+
pub fn as_ref(&self) -> &[$ty; $len] {
40+
let &$thing(ref dat) = self;
41+
dat
42+
}
43+
3744
#[inline]
3845
/// Returns the length of the object as an array
3946
pub fn len(&self) -> usize { $len }

0 commit comments

Comments
 (0)