Skip to content

Commit f00e8ad

Browse files
committed
FIX: enable From Cow/Vec/Box only when std is enabled
We could enabled these in non-std envorinments since HeaderVec depends on alloc, but i delay the decision about this for now.
1 parent 30430e6 commit f00e8ad

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/lib.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -769,17 +769,22 @@ xmacro::xmacro! {
769769
// Generates a lot `impl From` for `HeaderVec<(), T>` and `HeaderVec<H, T>`
770770
// The later variant is initialized from a tuple (H,T).
771771
$[
772-
from: lt: generics: where:
773-
(&[T]) () () ()
774-
(&mut [T]) () () ()
775-
(&[T; N]) () (const N: usize) ()
776-
(&mut[T; N]) () (const N: usize) ()
777-
([T; N]) () (const N: usize) ()
778-
(Cow<'a, [T]>) ('a,) () (where [T]: ToOwned)
779-
(Box<[T]>) () () ()
780-
(Vec<T>) () () ()
772+
attr:
773+
from: lt: generics: where:
774+
()(&[T]) () () ()
775+
()(&mut [T]) () () ()
776+
()(&[T; N]) () (const N: usize) ()
777+
()(&mut[T; N]) () (const N: usize) ()
778+
()([T; N]) () (const N: usize) ()
779+
(#[cfg(feature = "std")])
780+
(Cow<'a, [T]>) ('a,) () (where [T]: ToOwned)
781+
(#[cfg(feature = "std")])
782+
(Box<[T]>) () () ()
783+
(#[cfg(feature = "std")])
784+
(Vec<T>) () () ()
781785
]
782786

787+
$attr
783788
impl<$lt T: Clone, $generics> From<$from> for HeaderVec<(), T> $where {
784789
fn from(from: $from) -> Self {
785790
let mut hv = HeaderVec::new(());
@@ -788,6 +793,7 @@ xmacro::xmacro! {
788793
}
789794
}
790795

796+
$attr
791797
impl<$lt H, T: Clone, $generics> From<WithHeader<H, $from>> for HeaderVec<H, T> $where {
792798
fn from(from: WithHeader<H, $from>) -> Self {
793799
let mut hv = HeaderVec::new(from.0);

0 commit comments

Comments
 (0)