pub struct BotManifest {
pub v: u32,
pub commands: Vec<CommandSpec>,
}Expand description
The bot’s full published interface. Unknown fields are ignored on read
(forward compatibility); v gates breaking schema changes.
Fields§
§v: u32§commands: Vec<CommandSpec>Implementations§
Source§impl BotManifest
impl BotManifest
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Fail-closed structural validation, applied to our own manifests before publish AND to fetched foreign ones before use.
Sourcepub fn command(&self, name: &str) -> Option<&CommandSpec>
pub fn command(&self, name: &str) -> Option<&CommandSpec>
Look up a command by name.
Sourcepub fn from_event(event: &Event) -> Result<Self, String>
pub fn from_event(event: &Event) -> Result<Self, String>
Parse + validate a manifest from an event’s content. The event must be the manifest kind and is otherwise treated as untrusted input.
Trait Implementations§
Source§impl Clone for BotManifest
impl Clone for BotManifest
Source§fn clone(&self) -> BotManifest
fn clone(&self) -> BotManifest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BotManifest
impl Debug for BotManifest
Source§impl<'de> Deserialize<'de> for BotManifest
impl<'de> Deserialize<'de> for BotManifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BotManifest
impl RefUnwindSafe for BotManifest
impl Send for BotManifest
impl Sync for BotManifest
impl Unpin for BotManifest
impl UnsafeUnpin for BotManifest
impl UnwindSafe for BotManifest
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more