Skip to content

Commit 7b86e66

Browse files
committed
Move Read &mut impl after other Read impls
1 parent a1e006a commit 7b86e66

File tree

1 file changed

+68
-65
lines changed

1 file changed

+68
-65
lines changed

src/read.rs

Lines changed: 68 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -111,71 +111,6 @@ pub trait Read<'de>: private::Sealed {
111111
fn set_failed(&mut self, failed: &mut bool);
112112
}
113113

114-
impl<'de, R: Read<'de>> private::Sealed for &mut R {}
115-
impl<'de, R: Read<'de>> Read<'de> for &mut R {
116-
fn next(&mut self) -> Result<Option<u8>> {
117-
R::next(self)
118-
}
119-
120-
fn peek(&mut self) -> Result<Option<u8>> {
121-
R::peek(self)
122-
}
123-
124-
fn discard(&mut self) {
125-
R::discard(self)
126-
}
127-
128-
fn position(&self) -> Position {
129-
R::position(self)
130-
}
131-
132-
fn peek_position(&self) -> Position {
133-
R::peek_position(self)
134-
}
135-
136-
fn byte_offset(&self) -> usize {
137-
R::byte_offset(self)
138-
}
139-
140-
fn parse_str<'s>(&'s mut self, scratch: &'s mut Vec<u8>) -> Result<Reference<'de, 's, str>> {
141-
R::parse_str(self, scratch)
142-
}
143-
144-
fn parse_str_raw<'s>(
145-
&'s mut self,
146-
scratch: &'s mut Vec<u8>,
147-
) -> Result<Reference<'de, 's, [u8]>> {
148-
R::parse_str_raw(self, scratch)
149-
}
150-
151-
fn ignore_str(&mut self) -> Result<()> {
152-
R::ignore_str(self)
153-
}
154-
155-
fn decode_hex_escape(&mut self) -> Result<u16> {
156-
R::decode_hex_escape(self)
157-
}
158-
159-
#[cfg(feature = "raw_value")]
160-
fn begin_raw_buffering(&mut self) {
161-
R::begin_raw_buffering(self)
162-
}
163-
164-
#[cfg(feature = "raw_value")]
165-
fn end_raw_buffering<V>(&mut self, visitor: V) -> Result<V::Value>
166-
where
167-
V: Visitor<'de>,
168-
{
169-
R::end_raw_buffering(self, visitor)
170-
}
171-
172-
const should_early_return_if_failed: bool = R::should_early_return_if_failed;
173-
174-
fn set_failed(&mut self, failed: &mut bool) {
175-
R::set_failed(self, failed)
176-
}
177-
}
178-
179114
pub struct Position {
180115
pub line: usize,
181116
pub column: usize,
@@ -760,6 +695,74 @@ impl<'a> Read<'a> for StrRead<'a> {
760695

761696
//////////////////////////////////////////////////////////////////////////////
762697

698+
impl<'de, R: Read<'de>> private::Sealed for &mut R {}
699+
700+
impl<'de, R: Read<'de>> Read<'de> for &mut R {
701+
fn next(&mut self) -> Result<Option<u8>> {
702+
R::next(self)
703+
}
704+
705+
fn peek(&mut self) -> Result<Option<u8>> {
706+
R::peek(self)
707+
}
708+
709+
fn discard(&mut self) {
710+
R::discard(self)
711+
}
712+
713+
fn position(&self) -> Position {
714+
R::position(self)
715+
}
716+
717+
fn peek_position(&self) -> Position {
718+
R::peek_position(self)
719+
}
720+
721+
fn byte_offset(&self) -> usize {
722+
R::byte_offset(self)
723+
}
724+
725+
fn parse_str<'s>(&'s mut self, scratch: &'s mut Vec<u8>) -> Result<Reference<'de, 's, str>> {
726+
R::parse_str(self, scratch)
727+
}
728+
729+
fn parse_str_raw<'s>(
730+
&'s mut self,
731+
scratch: &'s mut Vec<u8>,
732+
) -> Result<Reference<'de, 's, [u8]>> {
733+
R::parse_str_raw(self, scratch)
734+
}
735+
736+
fn ignore_str(&mut self) -> Result<()> {
737+
R::ignore_str(self)
738+
}
739+
740+
fn decode_hex_escape(&mut self) -> Result<u16> {
741+
R::decode_hex_escape(self)
742+
}
743+
744+
#[cfg(feature = "raw_value")]
745+
fn begin_raw_buffering(&mut self) {
746+
R::begin_raw_buffering(self)
747+
}
748+
749+
#[cfg(feature = "raw_value")]
750+
fn end_raw_buffering<V>(&mut self, visitor: V) -> Result<V::Value>
751+
where
752+
V: Visitor<'de>,
753+
{
754+
R::end_raw_buffering(self, visitor)
755+
}
756+
757+
const should_early_return_if_failed: bool = R::should_early_return_if_failed;
758+
759+
fn set_failed(&mut self, failed: &mut bool) {
760+
R::set_failed(self, failed)
761+
}
762+
}
763+
764+
//////////////////////////////////////////////////////////////////////////////
765+
763766
/// Marker for whether StreamDeserializer can implement FusedIterator.
764767
pub trait Fused: private::Sealed {}
765768
impl<'a> Fused for SliceRead<'a> {}

0 commit comments

Comments
 (0)