pub struct ArgumentBuilder<S> { /* private fields */ }
Expand description
A node that hasn’t yet been built.
Implementations§
Source§impl<S> ArgumentBuilder<S>
impl<S> ArgumentBuilder<S>
A node that isn’t yet built.
pub fn new(value: ArgumentBuilderType) -> Self
Sourcepub fn then(self, argument: ArgumentBuilder<S>) -> Self
pub fn then(self, argument: ArgumentBuilder<S>) -> Self
Continue building this node with a child node.
literal("foo").then(
literal("bar").executes(|ctx: &CommandContext<()>| 42)
)
Sourcepub fn then_built(self, argument: CommandNode<S>) -> Self
pub fn then_built(self, argument: CommandNode<S>) -> Self
Add an already built child node to this node.
You should usually use Self::then
instead.
Sourcepub fn executes<F>(self, f: F) -> Self
pub fn executes<F>(self, f: F) -> Self
Set the command to be executed when this node is reached. If this is not present on a node, it is not a valid command.
literal("foo").executes(|ctx: &CommandContext<()>| 42)
Sourcepub fn requires<F>(self, requirement: F) -> Self
pub fn requires<F>(self, requirement: F) -> Self
Set the requirement for this node to be considered. If this is not present on a node, it is considered to always pass.
literal("foo")
.requires(|s: &CommandSource| s.opped)
// ...
pub fn redirect(self, target: Arc<RwLock<CommandNode<S>>>) -> Self
pub fn fork( self, target: Arc<RwLock<CommandNode<S>>>, modifier: Arc<RedirectModifier<S>>, ) -> Self
pub fn forward( self, target: Arc<RwLock<CommandNode<S>>>, modifier: Option<Arc<RedirectModifier<S>>>, fork: bool, ) -> Self
pub fn arguments(&self) -> &CommandNode<S>
Sourcepub fn build(self) -> CommandNode<S>
pub fn build(self) -> CommandNode<S>
Manually build this node into a CommandNode
. You probably don’t need
to do this yourself.
Trait Implementations§
Source§impl<S: Clone> Clone for ArgumentBuilder<S>
impl<S: Clone> Clone for ArgumentBuilder<S>
Source§fn clone(&self) -> ArgumentBuilder<S>
fn clone(&self) -> ArgumentBuilder<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<S> Freeze for ArgumentBuilder<S>
impl<S> !RefUnwindSafe for ArgumentBuilder<S>
impl<S> Send for ArgumentBuilder<S>
impl<S> Sync for ArgumentBuilder<S>
impl<S> Unpin for ArgumentBuilder<S>
impl<S> !UnwindSafe for ArgumentBuilder<S>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)