pub struct Builder<T, R, F, E>where
T: XyzArgs,
R: XyzSchema + Serialize,
F: Fn(&Ctx, &T) -> Result<R, E> + Send + Sync + 'static,
E: Error + Send + Sync + 'static,{ /* private fields */ }Expand description
Builder 是一条定义链:当前命令内联配置,命令列表经 also 追加,run 注册 + 派发 + 退出。
Implementations§
Source§impl<T, R, F, E> Builder<T, R, F, E>
impl<T, R, F, E> Builder<T, R, F, E>
Sourcepub fn description(self, s: impl Into<String>) -> Self
pub fn description(self, s: impl Into<String>) -> Self
长描述。
Sourcepub fn configure(self, cfg: Config) -> Self
pub fn configure(self, cfg: Config) -> Self
设置 Run/RunArgs 使用的派发器配置(模式词、通道能力)。在链任意 位置调用;run_args_config 为那次调用显式指定 Config。
Sourcepub fn also(self, cmds: &[&dyn Definable]) -> Self
pub fn also(self, cmds: &[&dyn Definable]) -> Self
把当前命令与传入的每条命令都注册进同一默认注册表,然后续链。可 再次调用追加更多。注册失败终止链:在 run 处浮出。
Sourcepub fn run_config(self, cfg: Config) -> !
pub fn run_config(self, cfg: Config) -> !
带自定义配置的 run。
Trait Implementations§
Auto Trait Implementations§
impl<T, R, F, E> !RefUnwindSafe for Builder<T, R, F, E>
impl<T, R, F, E> !UnwindSafe for Builder<T, R, F, E>
impl<T, R, F, E> Freeze for Builder<T, R, F, E>
impl<T, R, F, E> Send for Builder<T, R, F, E>
impl<T, R, F, E> Sync for Builder<T, R, F, E>
impl<T, R, F, E> Unpin for Builder<T, R, F, E>
impl<T, R, F, E> UnsafeUnpin for Builder<T, R, F, E>where
Command<T, R, F, E>: UnsafeUnpin,
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