Skip to content

Commit

Permalink
add alloc feature to serde_at (FactbirdHQ#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonnn authored Dec 11, 2023
1 parent 3af3d58 commit 23d9c18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions serde_at/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ default = []
custom-error-messages = []
std = []
hex_str_arrays = []
alloc = ["serde/alloc"]
11 changes: 9 additions & 2 deletions serde_at/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,19 @@ impl<'a, 'de> de::Deserializer<'de> for &'a mut Deserializer<'de> {
}
}

/// Unsupported. String is not available in no-std.
/// Supported only if alloc feature is enabled
fn deserialize_string<V>(self, _visitor: V) -> Result<V::Value>
where
V: Visitor<'de>,
{
unreachable!()
#[cfg(feature = "alloc")]
{
self.deserialize_str(_visitor)
}
#[cfg(not(feature = "alloc"))]
{
unreachable!()
}
}

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value>
Expand Down

0 comments on commit 23d9c18

Please sign in to comment.