X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Futil%2Ferrors.rs;h=fffe44fe462440b66338c7ccab1273ac68b3294b;hb=ae39d0e5a34ef021db50b12a7be96f0694fd1b18;hp=229fe039961b5aef8a8a47ddc03ce0b6e5c43d5a;hpb=4ed52804d3cd73f05bba6a705528d0d43495aa88;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/util/errors.rs b/lightning-c-bindings/src/lightning/util/errors.rs index 229fe03..fffe44f 100644 --- a/lightning-c-bindings/src/lightning/util/errors.rs +++ b/lightning-c-bindings/src/lightning/util/errors.rs @@ -8,16 +8,18 @@ //! Error types live here. -use std::str::FromStr; -use std::ffi::c_void; +use alloc::str::FromStr; +use core::ffi::c_void; use core::convert::Infallible; use bitcoin::hashes::Hash; use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; /// Indicates an error on the client's part (usually some variant of attempting to use too-low or /// too-high values) -#[must_use] #[derive(Clone)] +#[must_use] #[repr(C)] pub enum APIError { /// Indicates the API was wholly misused (see err for more). Cases where these can be returned @@ -64,7 +66,9 @@ pub enum APIError { script: crate::lightning::ln::script::ShutdownScript, }, } -use lightning::util::errors::APIError as nativeAPIError; +use lightning::util::errors::APIError as APIErrorImport; +pub(crate) type nativeAPIError = APIErrorImport; + impl APIError { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeAPIError {