How to implement read trait?
12:49 21 Nov 2025

I'm trying to work through Rust and using serde_yml as opposed to serde_yaml which has caused me much great confusion, and can't seem to find examples for parsing yaml from a file. I've been running into this error ...

error[E0277]: the trait bound `Result: std::io::Read` is not satisfied
    --> src/main.rs:77:39
     |
77   |     let yaml = serde_yml::from_reader(f)?;
     |                ---------------------- ^ the trait `std::io::Read` is not implemented for `Result`
     |                |
     |                required by a bound introduced by this call
     |
note: required by a bound in `from_reader`
    --> /home/pepp/.cargo/registry/src/index.crates.io-1949cf2c6b52557f/serde_yml-0.0.12/src/de.rs:2326:8
     |
2324 | pub fn from_reader(rdr: R) -> Result
     |        ----------- required by a bound in this function
2325 | where
2326 |     R: io::Read,
     |        ^^^^^^^^ required by this bound in `from_reader`

For more information about this error, try `rustc --explain E0277`.

My function is ...

fn parse_yml(conf: PathBuf) -> Result<(), Box> {

    println!("conf: {:?}", conf);

    let f = File::open(conf);

    let yaml = serde_yml::from_reader(f)?;

    println!("yaml: {}", yaml);

    Ok(())
}

My understanding is that File already contains the read trait, so when I read E0277, I'm confused about implementing a trait on something it already has. E0277 seems to be about implementing a user defined trait.

rust serde