Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•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(())
}

    
 
PREVIOUS NEXT
Tagged: #trait #objects #include #keyword
ADD COMMENT
Topic
Name
6+6 =