Trait secp256k1_sys::CPtr

source ·
pub trait CPtr {
    type Target;

    // Required methods
    fn as_c_ptr(&self) -> *const Self::Target;
    fn as_mut_c_ptr(&mut self) -> *mut Self::Target;
}
Expand description

A trait for producing pointers that will always be valid in C (assuming NULL pointer is a valid no-op).

Rust does not guarantee pointers to Zero Sized Types (https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts). In case the type is empty this trait will return a NULL pointer, which should be handled in C.

Required Associated Types§

Required Methods§

source

fn as_c_ptr(&self) -> *const Self::Target

source

fn as_mut_c_ptr(&mut self) -> *mut Self::Target

Implementations on Foreign Types§

source§

impl CPtr for [u8; 32]

source§

type Target = u8

source§

fn as_c_ptr(&self) -> *const Self::Target

source§

fn as_mut_c_ptr(&mut self) -> *mut Self::Target

source§

impl<T> CPtr for &[T]

source§

type Target = T

source§

fn as_c_ptr(&self) -> *const Self::Target

source§

fn as_mut_c_ptr(&mut self) -> *mut Self::Target

source§

impl<T> CPtr for [T]

source§

type Target = T

source§

fn as_c_ptr(&self) -> *const Self::Target

source§

fn as_mut_c_ptr(&mut self) -> *mut Self::Target

source§

impl<T: CPtr> CPtr for Option<T>

source§

type Target = <T as CPtr>::Target

source§

fn as_mut_c_ptr(&mut self) -> *mut Self::Target

source§

fn as_c_ptr(&self) -> *const Self::Target

Implementors§