core_json_traits/boxed.rs
1use alloc::boxed::Box;
2
3use crate::{BytesLike, Stack, JsonError, Value, JsonDeserialize, JsonStructure};
4
5impl<T: JsonDeserialize> JsonDeserialize for Box<T> {
6 fn deserialize<'bytes, 'parent, B: BytesLike<'bytes>, S: Stack>(
7 value: Value<'bytes, 'parent, B, S>,
8 ) -> Result<Self, JsonError<'bytes, B, S>> {
9 T::deserialize(value).map(Box::new)
10 }
11}
12
13impl<T: JsonStructure> JsonStructure for Box<T> {}