pub enum ScriptValue {
Num(f64),
Bool(bool),
Text(String),
}Expand description
One value a script exposes to the editor.
Three kinds, because those are the three a property inspector can edit without inventing a widget: a number, a flag, and a name. A script that needs more structure than this wants a table it manages itself, not an inspector row.
Variants§
Implementations§
Source§impl ScriptValue
impl ScriptValue
Sourcepub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
The label the inspector shows for this kind, and what a mismatched override is checked
against: an override whose kind differs from the declaration is never coerced, because
silently turning true into 1 is how a script starts misbehaving in a way nobody can
trace to the editor.
It is not ignored either, and this note used to say it was. Nothing filters
Script::properties on its way to Lua — see
every_stored_property_reaches_the_script_declared_or_not. The editor acted on the wrong
half of that sentence: it dropped mismatched overrides from its display and showed the
declared default, while the script kept running on the stale value. The inspector now
shows every stored value and marks the odd ones instead.
Trait Implementations§
Source§impl Clone for ScriptValue
impl Clone for ScriptValue
Source§fn clone(&self) -> ScriptValue
fn clone(&self) -> ScriptValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptValue
impl Debug for ScriptValue
Source§impl<'de> Deserialize<'de> for ScriptValue
impl<'de> Deserialize<'de> for ScriptValue
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 ScriptValue
impl PartialEq for ScriptValue
Source§impl Serialize for ScriptValue
impl Serialize for ScriptValue
impl StructuralPartialEq for ScriptValue
Auto Trait Implementations§
impl Freeze for ScriptValue
impl RefUnwindSafe for ScriptValue
impl Send for ScriptValue
impl Sync for ScriptValue
impl Unpin for ScriptValue
impl UnsafeUnpin for ScriptValue
impl UnwindSafe for ScriptValue
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more