Skip to content

Commit

Permalink
make serde module more no_std aware
Browse files Browse the repository at this point in the history
  • Loading branch information
cynecx committed Dec 7, 2024
1 parent b3f6b79 commit 0c87530
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions prost/src/serde/de.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::{boxed::Box, format};
use core::marker::PhantomData;
use serde::{de::DeserializeSeed, Deserializer};

Expand Down
1 change: 1 addition & 0 deletions prost/src/serde/de/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::vec::Vec;
use core::{fmt, marker::PhantomData};

use super::{DeserializeInto, DeserializerConfig};
Expand Down
2 changes: 1 addition & 1 deletion prost/src/serde/de/enum.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloc::borrow::{Cow, ToOwned};
use core::{fmt, marker::PhantomData};
use std::borrow::Cow;

use super::{DeserializeInto, DeserializerConfig, MaybeDeserializedValue};

Expand Down
7 changes: 3 additions & 4 deletions prost/src/serde/de/map.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{fmt, hash::Hash, marker::PhantomData};
use core::{fmt, marker::PhantomData};

use super::{DesIntoWithConfig, DeserializeInto, DeserializerConfig, MaybeDesIntoWithConfig};

Expand All @@ -7,7 +7,7 @@ pub struct MapDeserializer<KD, VD>(PhantomData<(KD, VD)>);
#[cfg(feature = "std")]
impl<K, V, KD, VD> DeserializeInto<std::collections::HashMap<K, V>> for MapDeserializer<KD, VD>
where
K: Eq + Hash,
K: Eq + core::hash::Hash,
KD: DeserializeInto<K>,
VD: DeserializeInto<V>,
{
Expand All @@ -20,7 +20,7 @@ where

impl<'de, K, V, KD, VD> serde::de::Visitor<'de> for Visitor<'_, K, V, KD, VD>
where
K: Eq + Hash,
K: Eq + core::hash::Hash,
KD: DeserializeInto<K>,
VD: DeserializeInto<V>,
{
Expand Down Expand Up @@ -53,7 +53,6 @@ where
}
}

#[cfg(feature = "std")]
impl<K, V, KD, VD> DeserializeInto<alloc::collections::BTreeMap<K, V>> for MapDeserializer<KD, VD>
where
K: Ord,
Expand Down
1 change: 1 addition & 0 deletions prost/src/serde/de/vec.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::vec::Vec;
use core::{fmt, marker::PhantomData};

use super::{DeserializeInto, DeserializerConfig, MaybeDesIntoWithConfig};
Expand Down
2 changes: 1 addition & 1 deletion prost/src/serde/ser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloc::vec::Vec;
use alloc::{boxed::Box, vec::Vec};

use core::{fmt::Display, marker::PhantomData, ops::Deref};
use serde::{ser::SerializeStruct, Serialize, Serializer};
Expand Down
1 change: 1 addition & 0 deletions prost/src/serde/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::{string::String, vec::Vec};
use core::fmt;

use super::{
Expand Down

0 comments on commit 0c87530

Please sign in to comment.