bp::secp256k1::ffi

Trait 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 <[u8; 32] as CPtr>::Target

Source§

fn as_mut_c_ptr(&mut self) -> *mut <[u8; 32] as CPtr>::Target

Source§

impl<T> CPtr for &[T]

Source§

type Target = T

Source§

fn as_c_ptr(&self) -> *const <&[T] as CPtr>::Target

Source§

fn as_mut_c_ptr(&mut self) -> *mut <&[T] as CPtr>::Target

Source§

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

Source§

type Target = <T as CPtr>::Target

Source§

fn as_mut_c_ptr(&mut self) -> *mut <Option<T> as CPtr>::Target

Source§

fn as_c_ptr(&self) -> *const <Option<T> as CPtr>::Target

Source§

impl<T> CPtr for [T]

Implementors§

Source§

impl CPtr for bp::secp256k1::ecdsa::Signature

Source§

impl CPtr for bp::secp256k1::ellswift::ElligatorSwift

Source§

impl CPtr for bp::secp256k1::schnorr::Signature

Source§

impl CPtr for bp::secp256k1::Keypair

Source§

impl CPtr for Message

Source§

impl CPtr for bp::secp256k1::PublicKey

This trait enables interaction with the FFI layer and even though it is part of the public API normal users should never need to directly interact with FFI types.

Source§

impl CPtr for SecretKey

Source§

impl CPtr for bp::secp256k1::XOnlyPublicKey

Source§

impl CPtr for bp::secp256k1::ffi::ElligatorSwift

Source§

impl CPtr for bp::secp256k1::ffi::Keypair

Source§

impl CPtr for bp::secp256k1::ffi::PublicKey

Source§

impl CPtr for bp::secp256k1::ffi::Signature

Source§

impl CPtr for bp::secp256k1::ffi::XOnlyPublicKey