pub struct Config {
pub query: String,
pub file_path: String,
pub ignore_case: bool,
}
Fields§
§query: String
§file_path: String
§ignore_case: bool
Implementations§
Source§impl Config
impl Config
Sourcepub fn build(args: impl Iterator<Item = String>) -> Result<Self, String>
pub fn build(args: impl Iterator<Item = String>) -> Result<Self, String>
Creates a Config
from the arguments which could come from
std::env::args()
or any other String
iterator.
§Examples
use xer_minigrep::Config;
fn main() {
let args = vec!(String::from("./minigrep"), String::from("body"), String::from("poem.txt"));
let iter = args.into_iter();
let config = Config::build(iter).unwrap();
println!("{:?}", config);
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more