Skip to main content

ClientCommandContents

Enum ClientCommandContents 

Source
#[non_exhaustive]
pub enum ClientCommandContents { Startup, Context { message: Cow<'static, str>, silent: bool, }, RegisterActions { actions: Vec<Action>, }, UnregisterActions { action_names: Vec<Cow<'static, str>>, }, ForceActions { state: Option<Cow<'static, str>>, query: Cow<'static, str>, ephemeral_context: Option<bool>, action_names: Vec<Cow<'static, str>>, }, ActionResult { id: String, success: bool, message: Option<Cow<'static, str>>, }, }
Expand description

Client command contents (everything except the game field). See ClientCommand docs for more info.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Startup

This message should be sent as soon as the game starts, to let Neuro know that the game is running.

This message clears all previously registered actions for this game and does initial setup, and as such should be the very first message that you send.

§

Context

This message can be sent to let Neuro know about something that is happening in game.

Fields

§message: Cow<'static, str>

A plaintext message that describes what is happening in the game. This information will be directly received by Neuro.

§silent: bool

If true, the message will be added to Neuro’s context without prompting her to respond to it. If false, Neuro might respond to the message directly, unless she is busy talking to someone else or to chat.

§

RegisterActions

This message registers one or more actions for Neuro to use.

Fields

§actions: Vec<Action>

An array of actions to be registered. If you try to register an action that is already registered, it will be ignored.

§

UnregisterActions

This message unregisters one or more actions, preventing Neuro from using them anymore.

Fields

§action_names: Vec<Cow<'static, str>>

The names of the actions to unregister. If you try to unregister an action that isn’t registered, there will be no problem.

§

ForceActions

This message forces Neuro to execute one of the listed actions as soon as possible. Note that this might take a bit if she is already talking.

Fields

§state: Option<Cow<'static, str>>

An arbitrary string that describes the current state of the game. This can be plaintext, JSON, Markdown, or any other format. This information will be directly received by Neuro.

§query: Cow<'static, str>

A plaintext message that tells Neuro what she is currently supposed to be doing (e.g. "It is now your turn. Please perform an action. If you want to use any items, you should use them before picking up the shotgun."). This information will be directly received by Neuro.

§ephemeral_context: Option<bool>

If false, the context provided in the state and query parameters will be remembered by Neuro after the actions force is compelted. If true, Neuro will only remember it for the duration of the actions force.

§action_names: Vec<Cow<'static, str>>

The names of the actions that Neuro should choose from.

§

ActionResult

This message needs to be sent as soon as possible after an action is validated, to allow Neuro to continue.

§Important

Until you send an action result, Neuro will just be waiting for the result of her action! Please make sure to send this as soon as possible. It should usually be sent after validating the action parameters, before it is actually executed in-game.

§Tip

Since setting success to false will retry the action force if there was one, if the action was not successful but you don’t want it to be retried, you should set success to true and provide an error message in the message field.

Fields

§id: String

The id of the action that this result is for. This is grabbed from the action message directly.

§success: bool

Whether or not the action was successful. If this is false and this action is part of an actions force, the whole actions force will be immediately retried by Neuro.

§message: Option<Cow<'static, str>>

A plaintext message that describes what happened when the action was executed. If not successful, this should be an error message. If successful, this can either be empty, or provide a small context to Neuro regarding the action she just took (e.g. "Remember to not share this with anyone."). This information will be directly received by Neuro.

Trait Implementations§

Source§

impl Clone for ClientCommandContents

Source§

fn clone(&self) -> ClientCommandContents

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientCommandContents

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ClientCommandContents

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ClientCommandContents

Source§

fn eq(&self, other: &ClientCommandContents) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ClientCommandContents

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ClientCommandContents

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<'de, T> Actions<'de> for T
where T: 'de + Deserialize<'de>,

Source§

fn deserialize<D>( discriminant: &str, de: D, ) -> Result<T, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,