diff --git a/source/postcard-schema-ng/src/impls/builtins_alloc.rs b/source/postcard-schema-ng/src/impls/builtins_alloc.rs index 6414655..dcb521d 100644 --- a/source/postcard-schema-ng/src/impls/builtins_alloc.rs +++ b/source/postcard-schema-ng/src/impls/builtins_alloc.rs @@ -27,6 +27,11 @@ impl Schema for alloc::collections::BTreeSet { const SCHEMA: &'static DataModelType = &DataModelType::Seq(K::SCHEMA); } +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for alloc::collections::VecDeque { + const SCHEMA: &'static DataModelType = &DataModelType::Seq(T::SCHEMA); +} + #[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] impl Schema for alloc::boxed::Box { const SCHEMA: &'static DataModelType = T::SCHEMA; @@ -36,3 +41,8 @@ impl Schema for alloc::boxed::Box { impl Schema for alloc::borrow::Cow<'_, T> { const SCHEMA: &'static DataModelType = T::SCHEMA; } + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for alloc::rc::Rc { + const SCHEMA: &'static DataModelType = T::SCHEMA; +} diff --git a/source/postcard-schema-ng/src/impls/builtins_std.rs b/source/postcard-schema-ng/src/impls/builtins_std.rs index 9bb85c6..5ce439a 100644 --- a/source/postcard-schema-ng/src/impls/builtins_std.rs +++ b/source/postcard-schema-ng/src/impls/builtins_std.rs @@ -43,6 +43,11 @@ impl Schema for std::collections::BTreeSet { const SCHEMA: &'static DataModelType = &DataModelType::Seq(K::SCHEMA); } +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::collections::VecDeque { + const SCHEMA: &'static DataModelType = &DataModelType::Seq(T::SCHEMA); +} + #[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] impl Schema for std::boxed::Box { const SCHEMA: &'static DataModelType = T::SCHEMA; @@ -52,3 +57,13 @@ impl Schema for std::boxed::Box { impl Schema for std::borrow::Cow<'_, T> { const SCHEMA: &'static DataModelType = T::SCHEMA; } + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::rc::Rc { + const SCHEMA: &'static DataModelType = T::SCHEMA; +} + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::sync::Arc { + const SCHEMA: &'static DataModelType = T::SCHEMA; +} diff --git a/source/postcard-schema-ng/tests/schema.rs b/source/postcard-schema-ng/tests/schema.rs index 31ae953..46ac812 100644 --- a/source/postcard-schema-ng/tests/schema.rs +++ b/source/postcard-schema-ng/tests/schema.rs @@ -356,6 +356,9 @@ fn smoke() { (dewit::>, "Option"), (dewit::>>, "Option"), (dewit::, "String"), + (dewit::>, "[u32]"), + (dewit::>, "u32"), + (dewit::>, "u32"), ]; for (f, s) in tests { assert_eq!(f().as_str(), *s); diff --git a/source/postcard-schema/src/impls/builtins_alloc.rs b/source/postcard-schema/src/impls/builtins_alloc.rs index 51e87f1..802f65a 100644 --- a/source/postcard-schema/src/impls/builtins_alloc.rs +++ b/source/postcard-schema/src/impls/builtins_alloc.rs @@ -42,6 +42,14 @@ impl Schema for alloc::collections::BTreeSet { }; } +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for alloc::collections::VecDeque { + const SCHEMA: &'static NamedType = &NamedType { + name: "VecDeque", + ty: &DataModelType::Seq(T::SCHEMA), + }; +} + #[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] impl Schema for alloc::boxed::Box { const SCHEMA: &'static NamedType = &NamedType { @@ -57,3 +65,11 @@ impl Schema for alloc::borrow::Cow< ty: T::SCHEMA.ty, }; } + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for alloc::rc::Rc { + const SCHEMA: &'static NamedType = &NamedType { + name: "Rc", + ty: T::SCHEMA.ty, + }; +} diff --git a/source/postcard-schema/src/impls/builtins_std.rs b/source/postcard-schema/src/impls/builtins_std.rs index 6f32569..1b539bd 100644 --- a/source/postcard-schema/src/impls/builtins_std.rs +++ b/source/postcard-schema/src/impls/builtins_std.rs @@ -67,6 +67,14 @@ impl Schema for std::collections::BTreeSet { }; } +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::collections::VecDeque { + const SCHEMA: &'static NamedType = &NamedType { + name: "VecDeque", + ty: &DataModelType::Seq(T::SCHEMA), + }; +} + #[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] impl Schema for std::boxed::Box { const SCHEMA: &'static NamedType = T::SCHEMA; @@ -76,3 +84,19 @@ impl Schema for std::boxed::Box { impl Schema for std::borrow::Cow<'_, T> { const SCHEMA: &'static NamedType = T::SCHEMA; } + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::rc::Rc { + const SCHEMA: &'static NamedType = &NamedType { + name: "Rc", + ty: T::SCHEMA.ty, + }; +} + +#[cfg_attr(docsrs, doc(cfg(any(feature = "alloc", feature = "use-std"))))] +impl Schema for std::sync::Arc { + const SCHEMA: &'static NamedType = &NamedType { + name: "Arc", + ty: T::SCHEMA.ty, + }; +} diff --git a/source/postcard-schema/tests/schema.rs b/source/postcard-schema/tests/schema.rs index d7699e2..2cfcee6 100644 --- a/source/postcard-schema/tests/schema.rs +++ b/source/postcard-schema/tests/schema.rs @@ -400,6 +400,9 @@ fn smoke() { (dewit::>, "Option"), (dewit::>>, "Option"), (dewit::, "String"), + (dewit::>, "[u32]"), + (dewit::>, "u32"), + (dewit::>, "u32"), ]; for (f, s) in tests { assert_eq!(f().as_str(), *s);