pub fn from_slice_into<'facet>(
input: &[u8],
partial: Partial<'facet, false>,
) -> Result<Partial<'facet, false>, DeserializeError>Expand description
Deserialize MsgPack bytes into an existing Partial.
This is useful for reflection-based deserialization where you don’t have
a concrete type T at compile time, only its Shape metadata. The Partial
must already be allocated for the target type.
This version produces owned strings (no borrowing from input).
§Example
use facet::Facet;
use facet_msgpack::from_slice_into;
use facet_reflect::Partial;
#[derive(Facet, Debug, PartialEq)]
struct Point {
x: i32,
y: i32,
}
// MsgPack encoding of {"x": 10, "y": 20}
let bytes = &[0x82, 0xa1, b'x', 0x0a, 0xa1, b'y', 0x14];
let partial = Partial::alloc_owned::<Point>().unwrap();
let partial = from_slice_into(bytes, partial).unwrap();
let value = partial.build().unwrap();
let point: Point = value.materialize().unwrap();
assert_eq!(point.x, 10);
assert_eq!(point.y, 20);