Struct pikadick::checks::enabled::EnabledCheckData
source · pub struct EnabledCheckData {
command_name_cache: Arc<Mutex<Vec<String>>>,
command_lookup: Arc<Mutex<HashMap<usize, String>>>,
}
Fields§
§command_name_cache: Arc<Mutex<Vec<String>>>
The set of all commands as strings.
command_lookup: Arc<Mutex<HashMap<usize, String>>>
A way to look up commands by CommandOptions and fn addr.
XXX MASSIVE HACK XXX
This uses the addresses of the names
field of CommandOptions
impls in order to compare commands.
This is necessary as this is all serenity gives to Check
functions.
The only reason this works is because the serenity macro for making commands is used as the only way to make commands,
as it recreates each names array for each command uniquely.
Implementations§
source§impl EnabledCheckData
impl EnabledCheckData
sourcepub fn new() -> Self
pub fn new() -> Self
Make a new EnabledCheckData
.
sourcepub fn add_groups(&self, groups: &[&CommandGroup])
pub fn add_groups(&self, groups: &[&CommandGroup])
Add a group to have its commands enabled/disabled.
pub fn get_command_name_from_options( &self, options: &CommandOptions ) -> Option<String>
sourcepub fn get_command_names(&self) -> MutexGuard<'_, RawMutex, Vec<String>>
pub fn get_command_names(&self) -> MutexGuard<'_, RawMutex, Vec<String>>
Returns a mutex guard to the list of command names.
Trait Implementations§
source§impl Clone for EnabledCheckData
impl Clone for EnabledCheckData
source§fn clone(&self) -> EnabledCheckData
fn clone(&self) -> EnabledCheckData
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 moresource§impl Debug for EnabledCheckData
impl Debug for EnabledCheckData
source§impl Default for EnabledCheckData
impl Default for EnabledCheckData
source§fn default() -> EnabledCheckData
fn default() -> EnabledCheckData
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for EnabledCheckData
impl Send for EnabledCheckData
impl Sync for EnabledCheckData
impl Unpin for EnabledCheckData
impl !UnwindSafe for EnabledCheckData
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
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
§impl<T> CloneableStorage for Twhere
T: Any + Send + Sync + Clone,
impl<T> CloneableStorage for Twhere T: Any + Send + Sync + Clone,
fn clone_storage(&self) -> Box<dyn CloneableStorage>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request