Struct sciter::value::Value
[−]
[src]
pub struct Value { /* fields omitted */ }
sciter::value
wrapper.
See the module-level documentation.
Methods
impl Value
[src]
pub fn new() -> Value
[src]
Return a new Sciter value object (undefined
).
pub fn array(length: usize) -> Value
[src]
Make an explicit array value with the given length.
pub fn map() -> Value
[src]
Make an explicit map value.
pub fn null() -> Value
[src]
Make an explicit json null value.
pub fn symbol(val: &str) -> Value
[src]
Make Sciter symbol value.
pub fn error(val: &str) -> Value
[src]
Make Sciter error value.
pub fn color(val: u32) -> Value
[src]
Make Sciter color value, in 0xAABBGGRR
form.
pub fn duration(val: f64) -> Value
[src]
Make Sciter duration value, in seconds.
pub fn angle(val: f64) -> Value
[src]
Make Sciter angle value, in radians.
pub fn parse(val: &str) -> Result<Value, usize>
[src]
Parse a json string into value. Returns the number of chars left unparsed in case of error.
pub fn parse_as(val: &str, how: VALUE_STRING_CVT_TYPE) -> Result<Value, usize>
[src]
Parse a json string into value. Returns the number of chars left unparsed in case of error.
pub fn get_type(&self) -> VALUE_TYPE
[src]
Get the inner type of the value.
pub fn full_type(&self) -> (VALUE_TYPE, UINT)
[src]
Get the inner type and its subtype (e.g. units) of the value.
pub fn isolate(self) -> IsolatedValue
[src]
Convert T_OBJECT
value type to JSON T_MAP
or T_ARRAY
types.
Also must be used to pass values between different threads.
pub fn clear(&mut self) -> &mut Value
[src]
Clear the value. It deallocates all assosiated structures that are not used anywhere else.
pub fn len(&self) -> usize
[src]
Return the number of items in the T_ARRAY
, T_MAP
, T_FUNCTION
and T_OBJECT
value types.
pub fn push<T: Into<Value>>(&mut self, src: T)
[src]
Append another value to the end of T_ARRAY
value.
pub fn set<T: Into<Value>>(&mut self, index: usize, src: T)
[src]
Insert or set value at the given index
of T_ARRAY
, T_MAP
, T_FUNCTION
and T_OBJECT
value.
pub fn get(&self, index: usize) -> 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.
pub fn set_item<TKey: Into<Value>, TValue: Into<Value>>(
&mut self,
key: TKey,
value: TValue
)
[src]
&mut self,
key: TKey,
value: TValue
)
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.
pub fn get_item<T: Into<Value>>(&self, key: T) -> Value
[src]
Retrieve the value of a sub-element by key.
pub fn key_at(&self, index: usize) -> Value
[src]
Retrieve the key of a sub-element by index
.
ⓘImportant traits for KeyIterator<'a>pub fn keys(&self) -> KeyIterator
[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>pub fn values(&self) -> SeqIterator
[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.
pub fn items(&self) -> Vec<(Value, Value)>
[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).
pub fn to_int(&self) -> Option<i32>
[src]
Value to integer.
pub fn to_bool(&self) -> Option<bool>
[src]
Value to bool.
pub fn to_float(&self) -> Option<f64>
[src]
Value to float.
pub fn to_color(&self) -> Option<u32>
[src]
Value to color.
pub fn to_duration(&self) -> Option<f64>
[src]
Value to duration.
pub fn to_angle(&self) -> Option<f64>
[src]
Value to angle.
pub fn as_string(&self) -> Option<String>
[src]
Value as string for T_STRING
type.
pub fn into_string(self) -> String
[src]
Value to json string (converted in-place). Subject to change.
pub fn as_bytes(&self) -> Option<&[u8]>
[src]
Value as a byte slice for T_BYTES
type.
pub fn to_bytes(&self) -> Option<Vec<u8>>
[src]
Value to byte vector for T_BYTES
type.
pub fn call(
&self,
this: Option<Value>,
args: &[Value],
name: Option<&str>
) -> Result<Value, VALUE_RESULT>
[src]
&self,
this: Option<Value>,
args: &[Value],
name: Option<&str>
) -> Result<Value, VALUE_RESULT>
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.
pub fn is_empty(&self) -> bool
[src]
Returns true
is self
is undefined
or has zero elements.
pub fn is_undefined(&self) -> bool
[src]
pub fn is_null(&self) -> bool
[src]
pub fn is_bool(&self) -> bool
[src]
pub fn is_int(&self) -> bool
[src]
pub fn is_float(&self) -> bool
[src]
pub fn is_bytes(&self) -> bool
[src]
pub fn is_string(&self) -> bool
[src]
pub fn is_symbol(&self) -> bool
[src]
pub fn is_error_string(&self) -> bool
[src]
pub fn is_date(&self) -> bool
[src]
pub fn is_currency(&self) -> bool
[src]
pub fn is_color(&self) -> bool
[src]
pub fn is_duration(&self) -> bool
[src]
pub fn is_angle(&self) -> bool
[src]
pub fn is_map(&self) -> bool
[src]
pub fn is_array(&self) -> bool
[src]
pub fn is_function(&self) -> bool
[src]
pub fn is_native_function(&self) -> bool
[src]
pub fn is_object(&self) -> bool
[src]
pub fn is_dom_element(&self) -> bool
[src]
Trait Implementations
impl Display for Value
[src]
Print Value
as json string
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Debug for Value
[src]
Print Value
as json string with explicit type showed.
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Drop for Value
[src]
Destroy pointed value.
impl Default for Value
[src]
Return default value (undefined
).
impl Clone for Value
[src]
Copies value.
All allocated objects are reference counted so copying is just a matter of increasing reference counts.
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Value
[src]
Compare two values.
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Index<usize> for Value
[src]
Get item by index for array type.
type Output = Value
The returned type after indexing.
fn index(&self, index: usize) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl Index<Value> for Value
[src]
Get item by key for map type.
type Output = Value
The returned type after indexing.
fn index(&self, key: Value) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl Index<&'static str> for Value
[src]
Get item by string key for map type.
type Output = Value
The returned type after indexing.
fn index(&self, key: &'static str) -> &Self::Output
[src]
Performs the indexing (container[index]
) operation.
impl From<i32> for Value
[src]
Value from integer.
impl From<f64> for Value
[src]
Value from float.
impl From<bool> for Value
[src]
Value from bool.
impl<'a> From<&'a str> for Value
[src]
Value from string.
impl From<String> for Value
[src]
Value from string.
impl FromStr for Value
[src]
Value from json string.
type Err = VALUE_RESULT
The associated error which can be returned from parsing.
fn from_str(val: &str) -> Result<Self, Self::Err>
[src]
Parses a string s
to return a value of this type. Read more
impl<'a> From<&'a [u8]> for Value
[src]
Value from binary array (sequence of bytes).
impl FromIterator<i32> for Value
[src]
Value from sequence of i32
.
fn from_iter<I: IntoIterator<Item = i32>>(iterator: I) -> Self
[src]
Creates a value from an iterator. Read more
impl FromIterator<f64> for Value
[src]
Value from sequence of f64
.
fn from_iter<I: IntoIterator<Item = f64>>(iterator: I) -> Self
[src]
Creates a value from an iterator. Read more
impl<'a> FromIterator<&'a str> for Value
[src]
Value from sequence of &str
.
fn from_iter<I: IntoIterator<Item = &'a str>>(iterator: I) -> Self
[src]
Creates a value from an iterator. Read more
impl FromIterator<String> for Value
[src]
Value from sequence of String
.
fn from_iter<I: IntoIterator<Item = String>>(iterator: I) -> Self
[src]
Creates a value from an iterator. Read more
impl<F> From<F> for Value where
F: Fn(&[Value]) -> Value,
[src]
F: Fn(&[Value]) -> Value,
Value from function.
impl FromValue for Value
[src]
fn from_value(v: &Value) -> Option<Self>
[src]
Converts value to specified type.
impl<'a> IntoIterator for &'a Value
[src]
Conversion into an Iterator
.
Adds the for
loop syntax support: for subitem in &value {]
.