diff --git a/src/array.rs b/src/array.rs index 582a296..a400c1e 100644 --- a/src/array.rs +++ b/src/array.rs @@ -1,3 +1,8 @@ +use std::fmt; + +use super::Rc; +use crate::ImplicitClone; + /// An immutable array type inspired by [Immutable.js](https://immutable-js.com/). /// /// This type is cheap to clone and thus implements [`ImplicitClone`]. It can be created based on a diff --git a/src/map.rs b/src/map.rs index cc76f6e..bad77d2 100644 --- a/src/map.rs +++ b/src/map.rs @@ -5,6 +5,8 @@ use indexmap::IndexMap as Map; use std::borrow::Borrow; use std::hash::Hash; +use super::Rc; + /// An immutable hash map type inspired by [Immutable.js](https://immutable-js.com/). /// /// This type is cheap to clone and thus implements [`ImplicitClone`]. It can be created based on a @@ -346,7 +348,7 @@ where for (k, v) in a.iter() { seq.serialize_entry(k, v)?; } - }, + } Self::Rc(a) => { for (k, v) in a.iter() { seq.serialize_entry(k, v)?; diff --git a/src/string.rs b/src/string.rs index 38548bd..105c694 100644 --- a/src/string.rs +++ b/src/string.rs @@ -1,8 +1,12 @@ use std::borrow::Cow; use std::cmp::Ordering; -use std::fmt::Debug; +use std::fmt::{self, Debug}; use std::str::FromStr; +use crate::ImplicitClone; + +use super::Rc; + /// An immutable string type inspired by [Immutable.js](https://immutable-js.com/). /// /// This type is cheap to clone and thus implements [`ImplicitClone`]. It can be created based on a diff --git a/src/sync.rs b/src/sync.rs index 0fc319f..5dd53a0 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -1,11 +1,18 @@ +use std::sync::Arc as Rc; + use crate::ImplicitClone; -use std::fmt; -type Rc = std::sync::Arc; +#[path = "array.rs"] +mod array; +#[cfg(feature = "map")] +#[path = "map.rs"] +mod map; +#[path = "string.rs"] +mod string; -include!("string.rs"); -include!("array.rs"); +pub use array::IArray; #[cfg(feature = "map")] -include!("map.rs"); +pub use map::IMap; +pub use string::IString; impl ImplicitClone for Rc {} diff --git a/src/unsync.rs b/src/unsync.rs index 3f587d6..cada2a0 100644 --- a/src/unsync.rs +++ b/src/unsync.rs @@ -1,10 +1,18 @@ -use crate::ImplicitClone; -use std::fmt; use std::rc::Rc; -include!("string.rs"); -include!("array.rs"); +use crate::ImplicitClone; + +#[path = "array.rs"] +mod array; +#[cfg(feature = "map")] +#[path = "map.rs"] +mod map; +#[path = "string.rs"] +mod string; + +pub use array::IArray; #[cfg(feature = "map")] -include!("map.rs"); +pub use map::IMap; +pub use string::IString; impl ImplicitClone for Rc {}