MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / decode

Function decode

src/derive/mod.rs:74–79  ·  view source on GitHub ↗

Decodes a [`&[u8]`][`prim@slice`] into an instance of `T:` [`Decode`]. Warning:** The format is subject to change between major versions.

(mut bytes: &'a [u8])

Source from the content-addressed store, hash-verified

72///
73/// **Warning:** The format is subject to change between major versions.
74pub fn decode<'a, T: Decode<'a>>(mut bytes: &'a [u8]) -> Result<T, Error> {
75 let mut decoder = T::Decoder::default();
76 decoder.populate(&mut bytes, 1)?;
77 expect_eof(bytes)?;
78 Ok(decode_inline_never(&mut decoder))
79}
80
81impl crate::buffer::Buffer {
82 /// Like [`encode`], but saves allocations between calls.

Callers 2

bitcode_decodeFunction · 0.85
comparison1Function · 0.85

Calls 3

expect_eofFunction · 0.85
decode_inline_neverFunction · 0.85
populateMethod · 0.45

Tested by

no test coverage detected