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

Function serialize

src/serde/ser.rs:26–36  ·  view source on GitHub ↗

Serializes a `T:` [`Serialize`] into a [`Vec `]. Warning:** The format is incompatible with [`decode`][`crate::decode`] and subject to change between major versions.

(t: &T)

Source from the content-addressed store, hash-verified

24 /// **Warning:** The format is incompatible with [`decode`][`crate::decode`] and subject to
25 /// change between major versions.
26 pub fn serialize<T: Serialize + ?Sized>(t: &T) -> Result<Vec<u8>, Error> {
27 let mut lazy = LazyEncoder::Unspecified {
28 reserved: NonZeroUsize::new(1),
29 };
30 let mut index_alloc = 0;
31 t.serialize(EncoderWrapper {
32 lazy: &mut lazy,
33 index_alloc: &mut index_alloc,
34 })?;
35 Ok(lazy.collect(index_alloc))
36 }
37}
38pub use inner::serialize;
39

Callers 8

bincode_serializeFunction · 0.85
bitcode_serializeFunction · 0.85
bench_bitcode_serializeFunction · 0.85
test_type_changedFunction · 0.85
test_tuple_len_changedFunction · 0.85
map_incorrect_len_valuesFunction · 0.85
test_serdeFunction · 0.85

Calls 2

serializeMethod · 0.80
collectMethod · 0.45

Tested by 3

test_type_changedFunction · 0.68
test_tuple_len_changedFunction · 0.68
test_serdeFunction · 0.68