X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Fc_types%2Fmod.rs;h=f31d55bd1b2c7d9ec67f30552f0036d27e5b28a6;hp=9e928a6065922e87409de08506ddf04e26e945a4;hb=11cd55b6baf2c94a44f0cd24774f0d822ff90d66;hpb=a032db3b20a0b3f70592eba1598af10b96f37b88 diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index 9e928a6..f31d55b 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -20,6 +20,8 @@ use core::ffi::c_void; pub(crate) use std::io::{self, Cursor, Read}; #[cfg(feature = "no-std")] pub(crate) use core2::io::{self, Cursor, Read}; +#[cfg(feature = "no-std")] +use alloc::{boxed::Box, vec::Vec, string::String}; #[repr(C)] /// A dummy struct of which an instance must never exist. @@ -65,6 +67,7 @@ impl PublicKey { } #[repr(C)] +#[derive(Clone)] /// Represents a valid secp256k1 secret key serialized as a 32 byte array. pub struct SecretKey { /// The bytes of the secret key @@ -192,6 +195,7 @@ pub enum IOError { Other, UnexpectedEof, } +#[cfg(feature = "std")] impl IOError { pub(crate) fn from_rust(err: std::io::Error) -> Self { match err.kind() { @@ -576,6 +580,9 @@ impl TakePointer<*mut T> for *mut T { pub(crate) mod ObjOps { + #[cfg(feature = "no-std")] + use alloc::boxed::Box; + #[inline] #[must_use = "returns new dangling pointer"] pub(crate) fn heap_alloc(obj: T) -> *mut T {