From 16e4cc28cf02429df5f0a2fd6c073dd0c4751daf Mon Sep 17 00:00:00 2001 From: lushaojie Date: Thu, 19 Dec 2024 10:54:35 +0800 Subject: [PATCH] fix: export MapAccess, SeqAccess and error module --- src/lib.rs | 2 ++ src/serde/de.rs | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a25c7f7..3dee2f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,6 +41,8 @@ pub use crate::lazyvalue::{ #[doc(inline)] pub use crate::pointer::{JsonPointer, PointerNode, PointerTree}; #[doc(inline)] +pub use crate::serde::de::{MapAccess, SeqAccess}; +#[doc(inline)] pub use crate::serde::{ from_reader, from_slice, from_slice_unchecked, from_str, to_lazyvalue, to_string, to_string_pretty, to_vec, to_vec_pretty, to_writer, to_writer_pretty, Deserializer, diff --git a/src/serde/de.rs b/src/serde/de.rs index 407107d..7bc0f12 100644 --- a/src/serde/de.rs +++ b/src/serde/de.rs @@ -935,13 +935,13 @@ impl<'de, 'a, R: Reader<'de>> de::Deserializer<'de> for &'a mut Deserializer } } -struct SeqAccess<'a, R: 'a> { +pub struct SeqAccess<'a, R: 'a> { de: &'a mut Deserializer, first: bool, // first is marked as } impl<'a, R: 'a> SeqAccess<'a, R> { - fn new(de: &'a mut Deserializer) -> Self { + pub fn new(de: &'a mut Deserializer) -> Self { SeqAccess { de, first: true } } } @@ -973,13 +973,13 @@ impl<'de, 'a, R: Reader<'de> + 'a> de::SeqAccess<'de> for SeqAccess<'a, R> { } } -struct MapAccess<'a, R: 'a> { +pub struct MapAccess<'a, R: 'a> { de: &'a mut Deserializer, first: bool, } impl<'a, R: 'a> MapAccess<'a, R> { - fn new(de: &'a mut Deserializer) -> Self { + pub fn new(de: &'a mut Deserializer) -> Self { MapAccess { de, first: true } } }