pub struct Opts {
pub api: OptsApi,
pub task: String,
pub init: bool,
pub full: bool,
pub filter: Vec<String>,
pub args: Vec<String>,
pub command: Vec<String>,
}Expand description
e-app
Fields§
§api: OptsApiAPI接口
task: String任务
init: bool是否初始化
full: bool是否完整信息
filter: Vec<String>筛选排除
args: Vec<String>扩展参数
command: Vec<String>扩展指令
Implementations§
Source§impl Opts
impl Opts
Sourcepub fn new<I>(args: Option<I>) -> Result<Self>
pub fn new<I>(args: Option<I>) -> Result<Self>
§Example
fn main() -> e_utils::Result<()> {
if e_app::input::Opts::check_empty() {
let _ = app::MyApp::launch()?;
} else {
let opts = e_app::input::Opts::new(None as Option<Vec<String>>)?;
let res = e_app::input::api(opts)?;
println!("{}", res.to_str()?);
}
Ok(())
}Sourcepub fn check_empty() -> bool
pub fn check_empty() -> bool
§检查空
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Opts
impl<'de> Deserialize<'de> for Opts
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl StructOpt for Opts
impl StructOpt for Opts
Source§fn from_clap(matches: &ArgMatches<'_>) -> Self
fn from_clap(matches: &ArgMatches<'_>) -> Self
Builds the struct from
clap::ArgMatches. It’s guaranteed to succeed
if matches originates from an App generated by StructOpt::clap called on
the same type, otherwise it must panic.Source§fn from_args() -> Selfwhere
Self: Sized,
fn from_args() -> Selfwhere
Self: Sized,
Builds the struct from the command line arguments (
std::env::args_os).
Calls clap::Error::exit on failure, printing the error message and aborting the program.Source§fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
fn from_args_safe() -> Result<Self, Error>where
Self: Sized,
Builds the struct from the command line arguments (
std::env::args_os).
Unlike StructOpt::from_args, returns clap::Error on failure instead of aborting the program,
so calling .exit is up to you.Source§fn from_iter<I>(iter: I) -> Self
fn from_iter<I>(iter: I) -> Self
Gets the struct from any iterator such as a
Vec of your making.
Print the error message and quit the program in case of failure. Read moreAuto Trait Implementations§
impl Freeze for Opts
impl RefUnwindSafe for Opts
impl Send for Opts
impl Sync for Opts
impl Unpin for Opts
impl UnsafeUnpin for Opts
impl UnwindSafe for Opts
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