@@ -2461,7 +2461,7 @@ pub trait BufRead: Read {
24612461 /// delimiter or EOF is found.
24622462 ///
24632463 /// If successful, this function will return the total number of bytes read,
2464- /// including the delimiter byte.
2464+ /// including the delimiter byte if found .
24652465 ///
24662466 /// This is useful for efficiently skipping data such as NUL-terminated strings
24672467 /// in binary file formats without buffering.
@@ -2489,7 +2489,7 @@ pub trait BufRead: Read {
24892489 /// ```
24902490 /// use std::io::{self, BufRead};
24912491 ///
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! ");
24932493 ///
24942494 /// // read name
24952495 /// let mut name = Vec::new();
@@ -2509,6 +2509,11 @@ pub trait BufRead: Read {
25092509 /// .expect("reading from cursor won't fail");
25102510 /// assert_eq!(num_bytes, 11);
25112511 /// 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);
25122517 /// ```
25132518 #[ stable( feature = "bufread_skip_until" , since = "1.83.0" ) ]
25142519 fn skip_until ( & mut self , byte : u8 ) -> Result < usize > {
0 commit comments