diff options
-rw-r--r-- | src/de/mod.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/de/mod.rs b/src/de/mod.rs index ef9cd76..290d843 100644 --- a/src/de/mod.rs +++ b/src/de/mod.rs @@ -189,7 +189,7 @@ pub fn from_str<'de, T: de::Deserialize<'de>>(input: &'de str) -> Result<T> { /// A deserializer for the querystring format. /// /// Supported top-level outputs are structs and maps. -pub(crate) struct QsDeserializer<'a> { +pub struct QsDeserializer<'a> { iter: IntoIter<Cow<'a, str>, Level<'a>>, value: Option<Level<'a>>, } @@ -213,9 +213,13 @@ impl<'a> QsDeserializer<'a> { } /// Returns a new `QsDeserializer<'a>`. - fn with_config(config: &Config, input: &'a [u8]) -> Result<Self> { + pub fn with_config(config: &Config, input: &'a [u8]) -> Result<Self> { parse::Parser::new(input, config.max_depth(), config.strict).as_deserializer() } + + pub fn new(input: &'a [u8]) -> Result<Self> { + Self::with_config(&Config::default(), input) + } } impl<'de> de::Deserializer<'de> for QsDeserializer<'de> { @@ -207,9 +207,9 @@ mod ser; pub(crate) mod utils; #[doc(inline)] -pub use de::Config; -#[doc(inline)] pub use de::{from_bytes, from_str}; +#[doc(inline)] +pub use de::{Config, QsDeserializer as Deserializer}; pub use error::Error; #[doc(inline)] pub use ser::{to_string, to_writer, Serializer}; |