mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 09:10:14 +00:00
refactor(commands): also use smolstr for commands themselves
This commit is contained in:
parent
af523a4c23
commit
b9867e7ea3
3 changed files with 12 additions and 8 deletions
|
|
@ -18,26 +18,28 @@ pub mod server_config;
|
|||
pub mod switch;
|
||||
pub mod system;
|
||||
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use crate::{command, token::Token};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Command {
|
||||
// TODO: fix hygiene
|
||||
pub tokens: Vec<Token>,
|
||||
pub help: String,
|
||||
pub cb: String,
|
||||
pub help: SmolStr,
|
||||
pub cb: SmolStr,
|
||||
}
|
||||
|
||||
impl Command {
|
||||
pub fn new(
|
||||
tokens: impl IntoIterator<Item = Token>,
|
||||
help: impl ToString,
|
||||
cb: impl ToString,
|
||||
help: impl Into<SmolStr>,
|
||||
cb: impl Into<SmolStr>,
|
||||
) -> Self {
|
||||
Self {
|
||||
tokens: tokens.into_iter().collect(),
|
||||
help: help.to_string(),
|
||||
cb: cb.to_string(),
|
||||
help: help.into(),
|
||||
cb: cb.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue