pub struct StateValueConfig<V> {
pub parse: Rc<dyn Fn(&Value) -> V>,
pub unparse: Rc<dyn Fn(&V) -> Value>,
pub is_equal: StateIsEqual<V>,
pub reset_on_copy_node: bool,
pub derived: bool,
pub schema: Option<SerializationSchema>,
}Expand description
StateValueConfig: how a state’s value parses from JSON (parse, which
gives the default for undefined), writes back (unparse) and compares
(isEqual), whether $copyNode resets it (resetOnCopyNode), whether
the node’s own code recomputes it (derived, @experimental), and the
schema parse was given as (StateConfig.schema), when it was one.
Fields§
§parse: Rc<dyn Fn(&Value) -> V>§unparse: Rc<dyn Fn(&V) -> Value>§is_equal: StateIsEqual<V>§reset_on_copy_node: bool§derived: bool§schema: Option<SerializationSchema>Implementations§
Source§impl<V: StateValue> StateValueConfig<V>
impl<V: StateValue> StateValueConfig<V>
Source§impl<V: SchemaValue + 'static> StateValueConfig<V>
impl<V: SchemaValue + 'static> StateValueConfig<V>
Sourcepub fn from_schema(schema: SerializationSchema) -> Self
pub fn from_schema(schema: SerializationSchema) -> Self
{parse: schema}: a state whose value schema describes, which also
gives it its equality (isSchemaEqual) and default, written back as
the value it parsed to. V holds the values the schema parses to
(Value holds any).
Trait Implementations§
Auto Trait Implementations§
impl<V> !RefUnwindSafe for StateValueConfig<V>
impl<V> !Send for StateValueConfig<V>
impl<V> !Sync for StateValueConfig<V>
impl<V> !UnwindSafe for StateValueConfig<V>
impl<V> Forget for StateValueConfig<V>
impl<V> Freeze for StateValueConfig<V>
impl<V> Move for StateValueConfig<V>
impl<V> Unpin for StateValueConfig<V>
impl<V> UnsafeUnpin for StateValueConfig<V>where
Rc<dyn Fn(&Value) -> V>: UnsafeUnpin,
Rc<dyn Fn(&V) -> Value>: UnsafeUnpin,
Rc<dyn Fn(&V, &V) -> bool>: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more