We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5814f27 commit ca27e25Copy full SHA for ca27e25
src/message.rs
@@ -28,7 +28,14 @@ impl EncodedMessage {
28
29
pub fn new<T: serde::Serialize>(data: &T, attributes: Option<HashMap<String, String>>) -> Self {
30
let json = serde_json::to_string(data).unwrap();
31
- let data = base64::encode(&json);
+ Self::new_binary(&json, attributes)
32
+ }
33
+
34
+ pub fn new_binary<T: AsRef<[u8]>>(
35
+ incoming: &T,
36
+ attributes: Option<HashMap<String, String>>,
37
+ ) -> Self {
38
+ let data = base64::encode(&incoming);
39
EncodedMessage { data, attributes }
40
}
41
0 commit comments