aboutsummaryrefslogtreecommitdiff
path: root/src/chat.rs
diff options
context:
space:
mode:
authorJoey Sacchini <joey@sacchini.net>2020-10-19 11:55:37 -0400
committerJoey Sacchini <joey@sacchini.net>2020-10-19 11:55:37 -0400
commit239a60fddab2694836f3117de429b9bf40256766 (patch)
tree007b927a3f3864639321cc988b0b0ad68f2c8662 /src/chat.rs
parenta2c1bcbf82a3ed7d76d464abab708f5472cfaa3f (diff)
downloadmcproto-rs-239a60fddab2694836f3117de429b9bf40256766.tar.gz
mcproto-rs-239a60fddab2694836f3117de429b9bf40256766.tar.bz2
mcproto-rs-239a60fddab2694836f3117de429b9bf40256766.zip
allow no_std with alloc
Diffstat (limited to 'src/chat.rs')
-rw-r--r--src/chat.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/chat.rs b/src/chat.rs
index 198e231..3913a6c 100644
--- a/src/chat.rs
+++ b/src/chat.rs
@@ -1,7 +1,6 @@
-use std::{fmt, str};
+use alloc::{vec::Vec, string::{String, ToString}, fmt, collections::{BTreeMap}, boxed::Box, borrow::ToOwned};
use serde::{Serialize, Deserialize, Deserializer, de, Serializer};
use serde::de::{Visitor, Error, IntoDeserializer, MapAccess};
-use std::collections::BTreeMap;
use serde::ser::SerializeMap;
use serde_json::Value;
use crate::{SerializeResult, DeserializeResult};
@@ -797,7 +796,8 @@ impl<'de> Deserialize<'de> for ColorCode {
}
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where
- E: Error, {
+ E: de::Error,
+ {
if let Some(code) = ColorCode::from_name(v) {
Ok(code)
} else {
@@ -1029,10 +1029,10 @@ impl super::Deserialize for Chat {
}
}
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
use super::protocol::TestRandom;
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
impl TestRandom for Chat {
fn test_gen_random() -> Self {
let str = String::test_gen_random();
@@ -1040,7 +1040,7 @@ impl TestRandom for Chat {
}
}
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
pub mod tests {
use super::*;