MCPcopy Create free account
hub / github.com/DioxusLabs/dioxus / encode

Method encode

packages/fullstack/src/encoding.rs:28–32  ·  view source on GitHub ↗
(data: impl Serialize, mut buf: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

26 }
27
28 fn encode(data: impl Serialize, mut buf: &mut Vec<u8>) -> Option<usize> {
29 let len = buf.len();
30 serde_json::to_writer(&mut buf, &data).ok()?;
31 Some(buf.len() - len)
32 }
33
34 fn decode<O: DeserializeOwned>(bytes: Bytes) -> Option<O> {
35 serde_json::from_slice(&bytes).ok()

Callers 8

serializedMethod · 0.80
fetchAgainstHostMethod · 0.80
fetchAgainstHostMethod · 0.80
typed_headerMethod · 0.80
into_response_partsMethod · 0.80
into_responseMethod · 0.80

Calls 2

lenMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected