Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-Escaping strings using a provided buffer #83

Merged
merged 14 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/de/enum_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ use serde::de;

use crate::de::{Deserializer, Error, Result};

pub(crate) struct UnitVariantAccess<'a, 'b> {
de: &'a mut Deserializer<'b>,
pub(crate) struct UnitVariantAccess<'a, 'b, 's> {
de: &'a mut Deserializer<'b, 's>,
}

impl<'a, 'b> UnitVariantAccess<'a, 'b> {
pub(crate) fn new(de: &'a mut Deserializer<'b>) -> Self {
impl<'a, 'b, 's> UnitVariantAccess<'a, 'b, 's> {
pub(crate) fn new(de: &'a mut Deserializer<'b, 's>) -> Self {
UnitVariantAccess { de }
}
}

impl<'a, 'de> de::EnumAccess<'de> for UnitVariantAccess<'a, 'de> {
impl<'a, 'de, 's> de::EnumAccess<'de> for UnitVariantAccess<'a, 'de, 's> {
type Error = Error;
type Variant = Self;

Expand All @@ -25,7 +25,7 @@ impl<'a, 'de> de::EnumAccess<'de> for UnitVariantAccess<'a, 'de> {
}
}

impl<'de, 'a> de::VariantAccess<'de> for UnitVariantAccess<'a, 'de> {
impl<'de, 'a, 's> de::VariantAccess<'de> for UnitVariantAccess<'a, 'de, 's> {
type Error = Error;

fn unit_variant(self) -> Result<()> {
Expand Down Expand Up @@ -54,17 +54,17 @@ impl<'de, 'a> de::VariantAccess<'de> for UnitVariantAccess<'a, 'de> {
}
}

pub(crate) struct VariantAccess<'a, 'b> {
de: &'a mut Deserializer<'b>,
pub(crate) struct VariantAccess<'a, 'b, 's> {
de: &'a mut Deserializer<'b, 's>,
}

impl<'a, 'b> VariantAccess<'a, 'b> {
pub(crate) fn new(de: &'a mut Deserializer<'b>) -> Self {
impl<'a, 'b, 's> VariantAccess<'a, 'b, 's> {
pub(crate) fn new(de: &'a mut Deserializer<'b, 's>) -> Self {
VariantAccess { de }
}
}

impl<'a, 'de> de::EnumAccess<'de> for VariantAccess<'a, 'de> {
impl<'a, 'de, 's> de::EnumAccess<'de> for VariantAccess<'a, 'de, 's> {
type Error = Error;
type Variant = Self;

Expand All @@ -78,7 +78,7 @@ impl<'a, 'de> de::EnumAccess<'de> for VariantAccess<'a, 'de> {
}
}

impl<'de, 'a> de::VariantAccess<'de> for VariantAccess<'a, 'de> {
impl<'de, 'a, 's> de::VariantAccess<'de> for VariantAccess<'a, 'de, 's> {
type Error = Error;

fn unit_variant(self) -> Result<()> {
Expand Down
16 changes: 8 additions & 8 deletions src/de/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ use serde::de::{self, Visitor};

use crate::de::{Deserializer, Error};

pub struct MapAccess<'a, 'b> {
de: &'a mut Deserializer<'b>,
pub struct MapAccess<'a, 'b, 's> {
de: &'a mut Deserializer<'b, 's>,
first: bool,
}

impl<'a, 'b> MapAccess<'a, 'b> {
pub(crate) fn new(de: &'a mut Deserializer<'b>) -> Self {
impl<'a, 'b, 's> MapAccess<'a, 'b, 's> {
pub(crate) fn new(de: &'a mut Deserializer<'b, 's>) -> Self {
MapAccess { de, first: true }
}
}

impl<'a, 'de> de::MapAccess<'de> for MapAccess<'a, 'de> {
impl<'a, 'de, 's> de::MapAccess<'de> for MapAccess<'a, 'de, 's> {
type Error = Error;

fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>, Error>
Expand Down Expand Up @@ -57,11 +57,11 @@ impl<'a, 'de> de::MapAccess<'de> for MapAccess<'a, 'de> {
}
}

struct MapKey<'a, 'b> {
de: &'a mut Deserializer<'b>,
struct MapKey<'a, 'b, 's> {
de: &'a mut Deserializer<'b, 's>,
}

impl<'de, 'a> de::Deserializer<'de> for MapKey<'a, 'de> {
impl<'de, 'a, 's> de::Deserializer<'de> for MapKey<'a, 'de, 's> {
type Error = Error;

fn deserialize_any<V>(self, _visitor: V) -> Result<V::Value, Error>
Expand Down
Loading