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

Function decode

atomic-objects/src/sync.rs:312–314  ·  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

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

Callers 6

decodeMethod · 0.70
empty_pack_is_emptyFunction · 0.70
from_did_keyMethod · 0.50

Calls 1

decode_with_limitFunction · 0.85