MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / decode

Function decode

atomic-objects/src/sync.rs:306–308  ·  view source on GitHub ↗

Decompress and deserialize a wire body, bounded by [`DEFAULT_MAX_DECOMPRESSED`]. Use [`decode_with_limit`] to set a tighter cap for untrusted input.

(bytes: &[u8])

Source from the content-addressed store, hash-verified

304/// [`DEFAULT_MAX_DECOMPRESSED`]. Use [`decode_with_limit`] to set a tighter cap
305/// for untrusted input.
306pub fn decode<T: DeserializeOwned>(bytes: &[u8]) -> Result<T, SyncError> {
307 decode_with_limit(bytes, DEFAULT_MAX_DECOMPRESSED)
308}
309
310/// Decompress and deserialize a wire body, refusing to inflate past `max_len`
311/// bytes. The bound is enforced during decompression (streaming), so a zip bomb

Calls 1

decode_with_limitFunction · 0.85