projects
/
ldk-c-bindings
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #61 from TheBlueMatt/main
[ldk-c-bindings]
/
lightning-c-bindings
/
src
/
c_types
/
mod.rs
diff --git
a/lightning-c-bindings/src/c_types/mod.rs
b/lightning-c-bindings/src/c_types/mod.rs
index 9e928a6065922e87409de08506ddf04e26e945a4..f31d55bd1b2c7d9ec67f30552f0036d27e5b28a6 100644
(file)
--- 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};
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.
#[repr(C)]
/// A dummy struct of which an instance must never exist.
@@
-65,6
+67,7
@@
impl PublicKey {
}
#[repr(C)]
}
#[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
/// 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,
}
Other,
UnexpectedEof,
}
+#[cfg(feature = "std")]
impl IOError {
pub(crate) fn from_rust(err: std::io::Error) -> Self {
match err.kind() {
impl IOError {
pub(crate) fn from_rust(err: std::io::Error) -> Self {
match err.kind() {
@@
-576,6
+580,9
@@
impl<T> TakePointer<*mut T> for *mut T {
pub(crate) mod ObjOps {
pub(crate) mod ObjOps {
+ #[cfg(feature = "no-std")]
+ use alloc::boxed::Box;
+
#[inline]
#[must_use = "returns new dangling pointer"]
pub(crate) fn heap_alloc<T>(obj: T) -> *mut T {
#[inline]
#[must_use = "returns new dangling pointer"]
pub(crate) fn heap_alloc<T>(obj: T) -> *mut T {