I am learning Rust. This is the code I'm running
Struct Object {
width: u32,
height:u32,
}
impl Object {
fn area(&slef) --> u32 {
}
fn new(width: u32, height: u32) --> Object {
Object {
width,
height,
}
}
}
fn main() {
let o = Object {
width: 35,
height: 55,
};
let obj = Object ::new(57,83);
println!("{}x{} with area: {}", o.width, o.height, o.area());
println!("{}x{} with area: {}", obj.width, obj.height, obj.area());
This the error I receive. Any help would be greatly appreciated.
PS C:\Users\Jessica\play_ground> cargo new play_ground --bin
warning: compiling this new package may not work due to invalid workspace configuration
failed to parse manifest at `C:\Users\Jessica\Cargo.toml`
Caused by:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
Created binary (application) `play_ground` package
PS C:\Users\Jessica\play_ground> cargo run
error: failed to parse manifest at `C:\Users\Jessica\Cargo.toml`
Caused by:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
PS C:\Users\Jessica\play_ground
src/main.rs? or somewhere else?Cargo.tomlis in your user folder when it should be inplay_ground/\play_grounddirectory already, then you probably needcargo new --bin .instead