Skip to content

Commit

Permalink
[ISSUE #55]🎨Fix CheetahString Serialize empty make Deserialize error🚀 (
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm authored Nov 16, 2024
1 parent 9381d08 commit 7580a0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cheetah_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::ops::Deref;
use std::str::FromStr;
use std::sync::Arc;

const EMPTY_STRING: &str = "";
pub const EMPTY_STRING: &str = "";

#[derive(Clone)]
#[repr(transparent)]
Expand Down
4 changes: 2 additions & 2 deletions src/serde.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cheetah_string::InnerString;
use crate::cheetah_string::{InnerString, EMPTY_STRING};
use crate::CheetahString;
use serde::de::{Error, Unexpected, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
Expand All @@ -14,7 +14,7 @@ impl Serialize for CheetahString {
InnerString::ArcVecString(s) => serializer.serialize_bytes(s),
#[cfg(feature = "bytes")]
InnerString::Bytes(bytes) => serializer.serialize_bytes(bytes.as_ref()),
InnerString::Empty => serializer.serialize_bytes(&[]),
InnerString::Empty => serializer.serialize_str(EMPTY_STRING),
}
}
}
Expand Down

0 comments on commit 7580a0c

Please sign in to comment.