[][src]Struct combu::hook::Hook

pub struct Hook {
    pub name: String,
    pub action: Option<HookAction>,
    pub authors: String,
    pub copyright: String,
    pub license: Option<(String, String)>,
    pub description: Option<String>,
    pub usage: String,
    pub alias: Vector<String>,
}

Hook is struct for action needs a context before sub.run.

Fields

name: String

name

action: Option<HookAction>

action

authors: String

authors

copyright: String

copyright

license: Option<(String, String)>

license

description: Option<String>

description

usage: String

usage

alias: Vector<String>

alias

Implementations

impl Hook[src]

pub fn new() -> Hook[src]

Creates new hook.

pub fn with_name<T: Into<String>>(name: T) -> Hook[src]

Creates new hook with name

pub fn with_all_field(
    name: String,
    action: Option<HookAction>,
    authors: String,
    copyright: String,
    license: Option<(String, String)>,
    description: Option<String>,
    usage: String,
    alias: Vector<String>
) -> Hook
[src]

Creates new hook with all field

impl Hook[src]

pub fn name<T: Into<String>>(self, name: T) -> Self[src]

Sets name.

pub fn authors<T: Into<String>>(self, authors: T) -> Self[src]

Sets authors.

pub fn copyright<T: Into<String>>(self, copyright: T) -> Self[src]

Sets copyright.

pub fn usage<T: Into<String>>(self, usage: T) -> Self[src]

Sets usage.

pub fn action(self, action: HookAction) -> Self[src]

Sets action.

pub fn license(self, license: (String, String)) -> Self[src]

Sets license.

pub fn description(self, description: String) -> Self[src]

Sets description.

pub fn alias<T: Into<String>>(self, alias: T) -> Self[src]

Add alias to this hook.

pub fn is(&self, name_or_alias: &str) -> bool[src]

Beturns true if name_or_alias matches command's name or one of alias at leaast. name_or_aliasがコマンド名がエイリアスのうち少なくとも一つにマッチした場合trueを返す

Trait Implementations

impl Clone for Hook[src]

impl Default for Hook[src]

Auto Trait Implementations

impl RefUnwindSafe for Hook

impl Send for Hook

impl Sync for Hook

impl Unpin for Hook

impl UnwindSafe for Hook

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.