@@ -2461,7 +2461,7 @@ pub trait BufRead: Read {
2461
2461
/// delimiter or EOF is found.
2462
2462
///
2463
2463
/// If successful, this function will return the total number of bytes read,
2464
- /// including the delimiter byte.
2464
+ /// including the delimiter byte if found .
2465
2465
///
2466
2466
/// This is useful for efficiently skipping data such as NUL-terminated strings
2467
2467
/// in binary file formats without buffering.
@@ -2489,7 +2489,7 @@ pub trait BufRead: Read {
2489
2489
/// ```
2490
2490
/// use std::io::{self, BufRead};
2491
2491
///
2492
- /// let mut cursor = io::Cursor::new(b"Ferris\0Likes long walks on the beach\0Crustacean\0");
2492
+ /// let mut cursor = io::Cursor::new(b"Ferris\0Likes long walks on the beach\0Crustacean\0! ");
2493
2493
///
2494
2494
/// // read name
2495
2495
/// let mut name = Vec::new();
@@ -2509,6 +2509,11 @@ pub trait BufRead: Read {
2509
2509
/// .expect("reading from cursor won't fail");
2510
2510
/// assert_eq!(num_bytes, 11);
2511
2511
/// assert_eq!(animal, b"Crustacean\0");
2512
+ ///
2513
+ /// // reach EOF
2514
+ /// let num_bytes = cursor.skip_until(b'\0')
2515
+ /// .expect("reading from cursor won't fail");
2516
+ /// assert_eq!(num_bytes, 1);
2512
2517
/// ```
2513
2518
#[ stable( feature = "bufread_skip_until" , since = "1.83.0" ) ]
2514
2519
fn skip_until ( & mut self , byte : u8 ) -> Result < usize > {
0 commit comments