#[doc(inline)]
pub use puniyu_command_types::*;
use std::borrow::Cow;
use std::sync::Arc;
#[derive(Clone)]
pub struct CommandInfo {
pub plugin_id: u64,
pub builder: Arc<dyn crate::Command>,
}
impl PartialEq for CommandInfo {
fn eq(&self, other: &Self) -> bool {
self.plugin_id == other.plugin_id && self.builder.name() == other.builder.name()
}
}
pub enum CommandId<'c> {
Id(u64),
Name(Cow<'c, str>),
}
impl From<u64> for CommandId<'_> {
fn from(id: u64) -> Self {
Self::Id(id)
}
}
impl<'c> From<&'c str> for CommandId<'c> {
fn from(name: &'c str) -> Self {
Self::Name(Cow::Borrowed(name))
}
}
impl From<String> for CommandId<'_> {
fn from(name: String) -> Self {
Self::Name(Cow::Owned(name))
}
}