pub struct App { /* private fields */ }Implementations§
Source§impl App
impl App
Sourcepub fn new(reg: &Registry) -> Result<App>
pub fn new(reg: &Registry) -> Result<App>
由注册表构建命令树。不可绑定的字段形状(嵌套 struct、元素为 struct 的切片)与有歧义的位置参数(optional 后面的 required)是 配置错误。
Sourcepub fn set_output(
&mut self,
out: Option<Box<dyn Write + Send>>,
err_out: Option<Box<dyn Write + Send>>,
)
pub fn set_output( &mut self, out: Option<Box<dyn Write + Send>>, err_out: Option<Box<dyn Write + Send>>, )
重定向输出流;None 保持现状。嵌入大程序/测试必备。
Sourcepub fn use_mw(&mut self, mw: ExecFunc)
pub fn use_mw(&mut self, mw: ExecFunc)
追加 Execute 中间件(最外层最先)。next() 续链到 Invoke + 渲染; 中间件可改写入参、短路(跳过 next 自绘)或包装 next 计时。
pub fn run_ctx(&mut self, ctx: &Ctx, args: &[String]) -> i32
pub fn execute( &mut self, ctx: &Ctx, node: CmdNode, args: &[String], format: Format, bin: &str, ) -> Result<()>
Auto Trait Implementations§
impl !RefUnwindSafe for App
impl !UnwindSafe for App
impl Freeze for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more