std-method
Read::chain: sequential sources
Combine two readers so the first is exhausted before the second supplies bytes. No separator is inserted automatically. Expected stdout (not executed): id=42 Common mistake: Expecting chain to insert a line break.
Formal Syntax & Structure
rust syntaxrust
first.chain(second) -> Chain<Self, R>Working Example
Example Snippetrust
fn main() { use std::io::Read; let mut both = (&b"id="[..]).chain(&b"42"[..]); let mut result = String::new(); both.read_to_string(&mut result).unwrap(); println!("{result}");}