Struct sciter::value::IsolatedValue [] [src]

pub struct IsolatedValue(_);

Used to pass values between threads.

sciter::Value can not be transferred across thread boundaries, because essentially it is the reference to a certain resource of the single-threaded script VM.

Value.isolate() is used to convert T_OBJECT value type to plain T_MAP or T_ARRAY JSON types. Isolated value does not contain references to the DOM anymore and therefore is not required to be accessed from GUI thread only. That said, you can move such values between threads.

Example:

let mut v = sciter::Value::map();
v.set_item("seven", 7);

let charon = v.isolate();
let tid = std::thread::spawn(move || {
    let mut v = charon;
    assert_eq!(v.len(), 1);
});
tid.join().unwrap();

Methods from Deref<Target = Value>

[src]

Get the inner type of the value.

[src]

Get the inner type and its subtype (e.g. units) of the value.

[src]

Clear the value. It deallocates all assosiated structures that are not used anywhere else.

[src]

Return the number of items in the T_ARRAY, T_MAP, T_FUNCTION and T_OBJECT value types.

[src]

Append another value to the end of T_ARRAY value.

[src]

Insert or set value at the given index of T_ARRAY, T_MAP, T_FUNCTION and T_OBJECT value.

[src]

Retreive value of sub-element at index.

  • T_ARRAY - nth element of the array;
  • T_MAP - value of the nth key/value pair in the map;
  • T_FUNCTION - value of the nth argument of the function.

[src]

Insert or set value of the sub-element by key.

  • T_MAP - sets named value in the map;
  • T_OBJECT - sets value of property of the object;
  • T_FUNCTION - sets named argument of the function;
  • otherwise it converts self to the map type and adds the key/value to it.

[src]

Retrieve the value of a sub-element by key.

[src]

Retrieve the key of a sub-element by index.

Important traits for KeyIterator<'a>
[src]

An iterator visiting all keys of key/value pairs in the map.

  • T_MAP - keys of key/value pairs in the map;
  • T_OBJECT - names of key/value properties in the object;
  • T_FUNCTION - names of arguments of the function (if any).

Important traits for SeqIterator<'a>
[src]

An iterator visiting all values in arbitrary order.

  • T_ARRAY - elements of the array;
  • T_MAP - values of key/value pairs in the map;
  • T_OBJECT - values of key/value properties in the object;
  • T_FUNCTION - values of arguments of the function.

[src]

An iterator visiting all key-value pairs in arbitrary order.

The iterator element type is (Value, Value). The Value must has a key-value type (map, object, function).

[src]

Value to integer.

[src]

Value to bool.

[src]

Value to float.

[src]

Value to color.

[src]

Value to duration.

[src]

Value to angle.

[src]

Value as string for T_STRING type.

[src]

Value as a byte slice for T_BYTES type.

[src]

Value to byte vector for T_BYTES type.

[src]

Function invocation for T_OBJECT with UT_OBJECT_FUNCTION value type.

Calls the tiscript function or method holded at Value with context of this object that will be known as this inside that function (it is optional for global functions).

The name here is an url or a name of the script - used for error reporting in script.

You can use the make_args!(args...) macro which helps you to construct script arguments from Rust types.

[src]

Returns true is self is undefined or has zero elements.

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl Debug for IsolatedValue
[src]

[src]

Formats the value using the given formatter. Read more

impl Send for IsolatedValue
[src]

Isolated value can be moved to another thread.

impl Deref for IsolatedValue
[src]

Dereference to &Value.

The resulting type after dereferencing.

[src]

Dereferences the value.

impl DerefMut for IsolatedValue
[src]

Dereference to &mut Value.

[src]

Mutably dereferences the value.

Auto Trait Implementations

impl !Sync for IsolatedValue