Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make stable work for std build #746

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion node-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! Contains stuff to instantiate communication with a substrate node.

#![cfg_attr(not(feature = "std"), no_std)]
#![feature(error_in_core)]
#![cfg_attr(not(feature = "std"), feature(error_in_core))]

extern crate alloc;

Expand Down
7 changes: 6 additions & 1 deletion src/api/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ use ac_node_api::{
use alloc::{boxed::Box, vec::Vec};
use codec::{Decode, Encode};

#[cfg(not(feature = "std"))]
use core::error::Error as ErrorT;
#[cfg(feature = "std")]
use std::error::Error as ErrorT;

pub type Result<T> = core::result::Result<T, Error>;

#[derive(Debug, derive_more::From)]
Expand Down Expand Up @@ -56,7 +61,7 @@ pub enum Error {
/// Could not find the expected block.
BlockNotFound,
/// Any custom Error.
Other(Box<dyn core::error::Error + Send + Sync + 'static>),
Other(Box<dyn ErrorT + Send + Sync + 'static>),
}

/// Encountered unexpected tx status during watch process or the extrinsic failed.
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

*/
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(error_in_core)]
#![cfg_attr(not(feature = "std"), feature(error_in_core))]

extern crate alloc;

Expand Down
6 changes: 5 additions & 1 deletion src/rpc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
*/

use alloc::{boxed::Box, string::String};
#[cfg(not(feature = "std"))]
use core::error::Error as ErrorT;
#[cfg(feature = "std")]
use std::error::Error as ErrorT;

pub type Result<T> = core::result::Result<T, Error>;

Expand All @@ -29,7 +33,7 @@ pub enum Error {
Io(String),
MaxConnectionAttemptsExceeded,
ConnectionClosed,
Client(Box<dyn core::error::Error + Send + Sync + 'static>),
Client(Box<dyn ErrorT + Send + Sync + 'static>),
}

impl From<serde_json::error::Error> for Error {
Expand Down