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