Skip to main content

ScenarioStepSerialized

Enum ScenarioStepSerialized 

Source
pub enum ScenarioStepSerialized {
Show 20 variants Comment { comment: String, }, InstallPlugin { context_policy: Option<ContextMode>, emit_responses: Option<bool>, nanoseconds_budget: Option<u64>, }, SetNanosecondsBudget { nanoseconds_budget: Option<u64>, }, FinalizeApp, SetupHandler { schedule: ScenarioSchedule, label: ScenarioLabel, }, LoadScriptAs { path: PathBuf, as_name: String, }, WaitForScriptAssetLoaded { name: String, }, SpawnEntityWithScript { name: String, script: String, }, AttachStaticScript { script: String, }, DetachStaticScript { script: String, }, DropScriptAsset { script: String, }, DespawnEntity { entity: String, }, EmitScriptCallbackEvent { label: ScenarioLabel, recipients: ScenarioRecipients, language: Option<ScenarioLanguage>, emit_response: bool, string_value: Option<String>, }, RunUpdateOnce, AssertCallbackSuccess { label: ScenarioLabel, attachment: ScenarioAttachment, expect_string_value: Option<String>, language: Option<ScenarioLanguage>, }, AssertNoCallbackResponsesEmitted, AssertContextState { attachment: ScenarioAttachment, state: ScenarioContextState, }, AssertContextResidents { script: ScenarioAttachment, residents_num: usize, }, ReloadScriptFrom { script: String, path: PathBuf, }, SetCurrentLanguage { language: ScenarioLanguage, },
}
Expand description

Describes the available scenario steps

Variants§

§

Comment

arbitrary comment

Fields

§comment: String

a comment

§

InstallPlugin

Installs the scripting plugin with the given settings and intializes the app

Fields

§context_policy: Option<ContextMode>

the context policy to use in the scenario

§emit_responses: Option<bool>

sets the emit_responses flag for core callbacks

§nanoseconds_budget: Option<u64>

the amount of nanoseconds to set the loading budget to

§

SetNanosecondsBudget

Sets the pipeline processing budget

Fields

§nanoseconds_budget: Option<u64>

the amount of nanoseconds to set the loading budget to

§

FinalizeApp

Called after the app config is set up, but before we run anything

§

SetupHandler

Sets up a handler for the given schedule and label. You can onle use one of the following callbacks:

  • on_test
  • on_test_post_update
  • on_test_last
  • callback_a
  • callback_b
  • callback_c

and main bevy schedule labels.

Fields

§schedule: ScenarioSchedule

the schedule in which to place this handler

§label: ScenarioLabel

the callback label to setup this handler for

§

LoadScriptAs

Loads a script from the given path and assigns it a name, this handle can be used later when loaded.

Fields

§path: PathBuf

the path to load the script from

§as_name: String

the name to give this script for future reference

§

WaitForScriptAssetLoaded

Waits until the script with the given name is loaded.

Fields

§name: String

the name of the script for which to wait

§

SpawnEntityWithScript

Spawns an entity with the given name and attaches the given script to it.

Fields

§name: String

the name to give this entity for future reference

§script: String

the script to spawn on the entity

§

AttachStaticScript

Attaches a static script

Fields

§script: String

the script to be attached

§

DetachStaticScript

Detaches a static script

Fields

§script: String

the script to be detached

§

DropScriptAsset

Drops the script asset from the scenario context.

Fields

§script: String

the script to drop the asset for

§

DespawnEntity

Despawns the entity with the given name.

Fields

§entity: String

the entity to despawn

§

EmitScriptCallbackEvent

Emits a ScriptCallbackEvent

Fields

§label: ScenarioLabel

the label to fire the callback for

§recipients: ScenarioRecipients

the recipients to set on the callback event

§language: Option<ScenarioLanguage>

the language to set on the callback event

§emit_response: bool

sets the emit_response flag on the callback event

§string_value: Option<String>

the string value to send as payload

§

RunUpdateOnce

Run the app update loop once

§

AssertCallbackSuccess

Asserts that a callback response was triggered for the given script attachment

Fields

§label: ScenarioLabel

the label for which to query

§attachment: ScenarioAttachment

the attachment to query

§expect_string_value: Option<String>

the string value to expect returned from the callback

§language: Option<ScenarioLanguage>

the language to query

§

AssertNoCallbackResponsesEmitted

Assert that no callbacks were emitted this frame

§

AssertContextState

Asserts that the context for the given attachment is in a certain state

Fields

§attachment: ScenarioAttachment

the attachment to query

§state: ScenarioContextState

the context state to assert

§

AssertContextResidents

Assert that the context for the given attachment has a certain amount of residents

Fields

§script: ScenarioAttachment

the attachment to query

§residents_num: usize

number of residents to expect

§

ReloadScriptFrom

Modifies the existing script asset by reloading it from the given path.

Fields

§script: String

the script to reload

§path: PathBuf

the path to reload the new content from

§

SetCurrentLanguage

Sets the current script language context to be used untll this is changed

Fields

§language: ScenarioLanguage

the language

Implementations§

Source§

impl ScenarioStepSerialized

Source

pub fn to_json(&self) -> Result<String, Error>

serialize a single scenario step to a json representation

Source

pub fn from_json(json: &str) -> Result<Self, Error>

deserialize a single scenario step from a json representation

Source

pub fn to_flat_string(&self) -> Result<String, Error>

converts to json object then converts to a format like: StepName key=“value”, key2=value2

Source

pub fn from_flat_string(flat_string: &str) -> Result<Self, Error>

deserialize a single scenario step from a flattened text representation

Trait Implementations§

Source§

impl Clone for ScenarioStepSerialized

Source§

fn clone(&self) -> ScenarioStepSerialized

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ScenarioStepSerialized

Source§

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

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

impl<'de> Deserialize<'de> for ScenarioStepSerialized

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 ScenarioStepSerialized

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 ScenarioStepSerialized

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 Eq for ScenarioStepSerialized

Source§

impl StructuralPartialEq for ScenarioStepSerialized

Auto Trait Implementations§

Blanket Implementations§

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynEq for T
where T: Any + Eq,

Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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<T> ConditionalSend for T
where T: Send,

Source§

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