aboutsummaryrefslogtreecommitdiff
path: root/src/nbt.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/nbt.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/nbt.rs')
-rw-r--r--src/nbt.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nbt.rs b/src/nbt.rs
index ad5de3c..3424b9a 100644
--- a/src/nbt.rs
+++ b/src/nbt.rs
@@ -2,9 +2,9 @@ use crate::utils::{
read_int, read_long, read_one_byte, read_short, take, write_int, write_long, write_short,
};
use crate::{DeserializeErr, DeserializeResult, Deserialized};
-use std::fmt;
+use alloc::{string::{String, ToString}, borrow::ToOwned, fmt, vec::Vec};
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
use crate::protocol::TestRandom;
#[derive(Clone, Debug, PartialEq)]
@@ -26,7 +26,7 @@ impl NamedTag {
}
}
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
impl TestRandom for NamedTag {
fn test_gen_random() -> Self {
Self {
@@ -125,7 +125,7 @@ impl Tag {
}
}
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
impl TestRandom for Tag {
fn test_gen_random() -> Self {
let random_idx = rand::random::<usize>() % 8;
@@ -518,7 +518,7 @@ impl Tag {
}
// test
-#[cfg(test)]
+#[cfg(all(test, feature = "std"))]
mod tests {
use super::*;
use flate2::read::GzDecoder;