ConvertMessage

Trait ConvertMessage 

Source
pub trait ConvertMessage:
    Sized
    + Send
    + Sync {
    type Error: Error + Send;

    // Required method
    fn convert_from_message(message: Message) -> Result<Vec<Self>, Self::Error>;
}
Expand description

A useful trait to help convert rig::completion::Message to your own message type.

Particularly useful if you don’t want to create a free-standing function as when trying to use TryFrom<T>, you would normally run into the orphan rule as Vec is technically considered a foreign type (it’s owned by stdlib).

Required Associated Types§

Required Methods§

Source

fn convert_from_message(message: Message) -> Result<Vec<Self>, Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§