Hi there,
I had a naive question ( I am fairly new to this amazing language ) and was hoping to get some help.
I have a struct called Args in a file called ** context_args.rs** under src directory.
use std::path::PathBuf;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(
name = "build_script",
about = "A script that builds and installs a project",
rename_all = "kebab-case"
)]
pub struct Args {
#[structopt(parse(from_os_str))]
workspace_location: PathBuf,
}
Now in the src/main.rs, I would like to use this structure but keep getting this error:
**no function or associated item named
from_argsfound for struct
context_args::Args in the current scope**
mod context_args;
use context_args::Args;
fn main() {
let args = Args::from_args(); // error function or associated item not found in `context_args::Args`
}
What am I doing wrong and how can I fix this?