pub fn ser_bytes_stringify<S, T>(
value: &T,
serializer: S,
) -> Result<S::Ok, S::Error>
Expand description
Serialize bytes to string.
ยงExamples
use serde::Serialize;
#[derive(Debug, PartialEq, Serialize)]
struct Ljf {
#[serde(serialize_with = "array_bytes::ser_bytes_stringify")]
_0: Vec<u8>,
}
assert_eq!(
serde_json::to_string::<Ljf>(&Ljf { _0: b"Love Jane Forever".to_vec() }).unwrap(),
r#"{"_0":"Love Jane Forever"}"#
);