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
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
SetNanosecondsBudget
Sets the pipeline processing budget
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_teston_test_post_updateon_test_lastcallback_acallback_bcallback_c
and main bevy schedule labels.
Fields
schedule: ScenarioSchedulethe schedule in which to place this handler
label: ScenarioLabelthe 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
WaitForScriptAssetLoaded
Waits until the script with the given name is loaded.
SpawnEntityWithScript
Spawns an entity with the given name and attaches the given script to it.
Fields
AttachStaticScript
Attaches a static script
DetachStaticScript
Detaches a static script
DropScriptAsset
Drops the script asset from the scenario context.
DespawnEntity
Despawns the entity with the given name.
EmitScriptCallbackEvent
Emits a ScriptCallbackEvent
Fields
label: ScenarioLabelthe label to fire the callback for
recipients: ScenarioRecipientsthe recipients to set on the callback event
language: Option<ScenarioLanguage>the language to set on the callback event
RunUpdateOnce
Run the app update loop once
AssertCallbackSuccess
Asserts that a callback response was triggered for the given script attachment
Fields
label: ScenarioLabelthe label for which to query
attachment: ScenarioAttachmentthe attachment to query
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: ScenarioAttachmentthe attachment to query
state: ScenarioContextStatethe context state to assert
AssertContextResidents
Assert that the context for the given attachment has a certain amount of residents
Fields
script: ScenarioAttachmentthe attachment to query
ReloadScriptFrom
Modifies the existing script asset by reloading it from the given path.
SetCurrentLanguage
Sets the current script language context to be used untll this is changed
Fields
language: ScenarioLanguagethe language
Implementations§
Source§impl ScenarioStepSerialized
impl ScenarioStepSerialized
Sourcepub fn to_json(&self) -> Result<String, Error>
pub fn to_json(&self) -> Result<String, Error>
serialize a single scenario step to a json representation
Sourcepub fn from_json(json: &str) -> Result<Self, Error>
pub fn from_json(json: &str) -> Result<Self, Error>
deserialize a single scenario step from a json representation
Sourcepub fn to_flat_string(&self) -> Result<String, Error>
pub fn to_flat_string(&self) -> Result<String, Error>
converts to json object then converts to a format like: StepName key=“value”, key2=value2
Sourcepub fn from_flat_string(flat_string: &str) -> Result<Self, Error>
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
impl Clone for ScenarioStepSerialized
Source§fn clone(&self) -> ScenarioStepSerialized
fn clone(&self) -> ScenarioStepSerialized
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScenarioStepSerialized
impl Debug for ScenarioStepSerialized
Source§impl<'de> Deserialize<'de> for ScenarioStepSerialized
impl<'de> Deserialize<'de> for ScenarioStepSerialized
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>,
Source§impl PartialEq for ScenarioStepSerialized
impl PartialEq for ScenarioStepSerialized
Source§impl Serialize for ScenarioStepSerialized
impl Serialize for ScenarioStepSerialized
impl Eq for ScenarioStepSerialized
impl StructuralPartialEq for ScenarioStepSerialized
Auto Trait Implementations§
impl Freeze for ScenarioStepSerialized
impl RefUnwindSafe for ScenarioStepSerialized
impl Send for ScenarioStepSerialized
impl Sync for ScenarioStepSerialized
impl Unpin for ScenarioStepSerialized
impl UnsafeUnpin for ScenarioStepSerialized
impl UnwindSafe for ScenarioStepSerialized
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.