Answers for "rust•armanazi•error•[E0782]: trait objects must include the `dyn` keyword"

0

rust•armanazi•error•[E0782]: trait objects must include the `dyn` keyword

fn main() -> Result<(), Error> {
    let f = File::open("hello.txt")?;
      Ok(())
}
//folowing is not error exist
use std::error::Error;
use std::fs::File;

fn main() -> Result<(), Box<dyn Error>> {
    let f = File::open("hello.txt")?;

    Ok(())
}
Posted by: Guest on March-17-2022

Code answers related to "rust•armanazi•error•[E0782]: trait objects must include the `dyn` keyword"

Browse Popular Code Answers by Language