Trait serenity::utils::ArgumentConvert [−][src]
pub trait ArgumentConvert: Sized { type Err; fn convert<'life0, 'life1, 'async_trait>(
ctx: &'life0 Context,
guild_id: Option<GuildId>,
channel_id: Option<ChannelId>,
s: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait; }
Expand description
Parse a value from a string in context of a received message.
This trait is a superset of std::str::FromStr
. The
difference is that this trait aims to support serenity-specific Discord types like Member
or Message
.
Trait implementations may do network requests as part of their parsing procedure.
Useful for implementing argument parsing in command frameworks.
Associated Types
Required methods
Parses a string s
as a command parameter of this type.