Skip to content

Commit

Permalink
Support no_std stage 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem-Romanenia committed Aug 5, 2024
1 parent 728f1c6 commit f989e46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/Artem-Romanenia/o2o"

[dependencies]
o2o-impl = { version = "0.4.9-alpha.1", path = "o2o-impl" }
o2o-macros = { version = "0.4.9-alpha.1", path = "o2o-macros" }
o2o-impl = { version = "0.4.9-alpha.1", path = "o2o-impl", optional = true }
o2o-macros = { version = "0.4.9-alpha.1", path = "o2o-macros", optional = true }

[features]
default = ["macro"]
macro = ["dep:o2o-impl", "dep:o2o-macros"]

[workspace]
members = ["o2o-impl", "o2o-macros", "o2o-tests"]
7 changes: 2 additions & 5 deletions o2o-impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ pub fn derive(node: &DeriveInput) -> Result<TokenStream> {
validate(&input)?;
Ok(data_type_impl(input))
},
_ => Err(Error::new_spanned(
node,
"#[derive(o2o)] only supports structs and enums.",
))
_ => Err(Error::new_spanned(node, "#[derive(o2o)] only supports structs and enums."))
}
}

Expand Down Expand Up @@ -384,7 +381,7 @@ fn struct_init_block<'a>(input: &'a Struct, ctx: &ImplContext) -> TokenStream {
unique_paths.insert(path);
make_tuple(path, FieldData::Field(x))
}).collect::<Vec<(usize, &str, FieldData)>>());

fields.extend(input.attrs.ghosts_attrs.iter()
.flat_map(|x| &x.attr.ghost_data)
.filter(|x| unique_paths.insert(x.get_child_path_str(None)))
Expand Down
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![doc = include_str!("../README.md")]

extern crate o2o_impl;
extern crate o2o_macros;
#[cfg(feature = "macro")]
pub use o2o_macros::*;

pub mod traits;

pub use o2o_macros::*;

0 comments on commit f989e46

Please sign in to comment.