Skip to content

Commit 395e56c

Browse files
committed
Move documentation from buffered reader to an XmlSource trait
1 parent 8f700ca commit 395e56c

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/reader/buffered_reader.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ macro_rules! impl_buffered_source {
159159
}
160160
}
161161

162-
/// Consume and discard all the whitespace until the next non-whitespace
163-
/// character or EOF.
164162
$($async)? fn skip_whitespace(&mut self, position: &mut usize) -> Result<()> {
165163
loop {
166164
break match self $(.$reader)? .fill_buf() $(.$await)? {
@@ -180,8 +178,6 @@ macro_rules! impl_buffered_source {
180178
}
181179
}
182180

183-
/// Consume and discard one character if it matches the given byte. Return
184-
/// true if it matched.
185181
$($async)? fn skip_one(&mut self, byte: u8, position: &mut usize) -> Result<bool> {
186182
// search byte must be within the ascii range
187183
debug_assert!(byte.is_ascii());
@@ -196,8 +192,6 @@ macro_rules! impl_buffered_source {
196192
}
197193
}
198194

199-
/// Return one character without consuming it, so that future `read_*` calls
200-
/// will still include it. On EOF, return None.
201195
$($async)? fn peek_one(&mut self) -> Result<Option<u8>> {
202196
loop {
203197
break match self $(.$reader)? .fill_buf() $(.$await)? {

src/reader/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,22 @@ trait XmlSource<'r, B> {
667667
/// [events]: crate::events::Event
668668
fn read_element(&mut self, buf: B, position: &mut usize) -> Result<Option<&'r [u8]>>;
669669

670+
/// Consume and discard all the whitespace until the next non-whitespace
671+
/// character or EOF.
672+
///
673+
/// # Parameters
674+
/// - `position`: Will be increased by amount of bytes consumed
670675
fn skip_whitespace(&mut self, position: &mut usize) -> Result<()>;
671676

677+
/// Consume and discard one character if it matches the given byte. Return
678+
/// `true` if it matched.
679+
///
680+
/// # Parameters
681+
/// - `position`: Will be increased by 1 if byte is matched
672682
fn skip_one(&mut self, byte: u8, position: &mut usize) -> Result<bool>;
673683

684+
/// Return one character without consuming it, so that future `read_*` calls
685+
/// will still include it. On EOF, return `None`.
674686
fn peek_one(&mut self) -> Result<Option<u8>>;
675687
}
676688

0 commit comments

Comments
 (0)