mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
feat(commands): add cs codegen to statically use params and flags in bot code, remove Any
This commit is contained in:
parent
0c012e98b5
commit
07e8a4851a
20 changed files with 297 additions and 417 deletions
|
|
@ -38,15 +38,15 @@ impl TreeBranch {
|
|||
);
|
||||
}
|
||||
|
||||
pub(super) fn command(&self) -> Option<Command> {
|
||||
pub fn command(&self) -> Option<Command> {
|
||||
self.current_command.clone()
|
||||
}
|
||||
|
||||
pub(super) fn possible_tokens(&self) -> impl Iterator<Item = &Token> {
|
||||
pub fn possible_tokens(&self) -> impl Iterator<Item = &Token> {
|
||||
self.branches.keys()
|
||||
}
|
||||
|
||||
pub(super) fn possible_commands(&self, max_depth: usize) -> impl Iterator<Item = &Command> {
|
||||
pub fn possible_commands(&self, max_depth: usize) -> impl Iterator<Item = &Command> {
|
||||
// dusk: i am too lazy to write an iterator for this without using recursion so we box everything
|
||||
fn box_iter<'a>(
|
||||
iter: impl Iterator<Item = &'a Command> + 'a,
|
||||
|
|
@ -69,7 +69,11 @@ impl TreeBranch {
|
|||
commands
|
||||
}
|
||||
|
||||
pub(super) fn get_branch(&self, token: &Token) -> Option<&TreeBranch> {
|
||||
pub fn get_branch(&self, token: &Token) -> Option<&Self> {
|
||||
self.branches.get(token)
|
||||
}
|
||||
|
||||
pub fn branches(&self) -> impl Iterator<Item = (&Token, &Self)> {
|
||||
self.branches.iter()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue