Struct sciter::value::Value
[−]
[src]
pub struct Value { /* fields omitted */ }
sciter::value
wrapper.
See the module-level documentation.
Methods
impl Value
[src]
fn new() -> Value
[src]
Return a new sciter value object (undefined).
fn array(length: usize) -> Value
[src]
Make explicit array value with given length.
fn map() -> Value
[src]
Make explicit map value.
fn null() -> Value
[src]
Make explicit json null value.
fn symbol(val: &str) -> Value
[src]
Make sciter symbol value.
fn error(val: &str) -> Value
[src]
Make sciter error value.
fn color(val: u32) -> Value
[src]
Make sciter color value, in 0xAABBGGRR form.
fn duration(val: f64) -> Value
[src]
Make sciter duration value, in seconds.
fn angle(val: f64) -> Value
[src]
Make sciter angle value, in radians.
fn parse(val: &str) -> Result<Value, u32>
[src]
Parse json string into value.
fn parse_as(val: &str, how: VALUE_STRING_CVT_TYPE) -> Result<Value, u32>
[src]
Parse json string into value.
fn from_str(val: &str) -> Result<Self, VALUE_RESULT>
[src]
Parse json string into value.
Note that Value::from_str()
parses a json string to value object and returns a Result<Value>
unlike Value::from()
, which returns just string object only.
fn get_type(&self) -> VALUE_TYPE
[src]
Get inner value type.
fn full_type(&self) -> (VALUE_TYPE, UINT)
[src]
Get inner value type and its subtype (e.g. units).
fn isolate(&mut self)
[src]
Convert T_OBJECT value type to JSON T_MAP or T_ARRAY. Also must be used if you need to pass values between different threads.
fn clear(&mut self) -> &mut Value
[src]
Clear the VALUE and deallocates all assosiated structures that are not used anywhere else.
fn len(&self) -> usize
[src]
Return the number of items in the T_ARRAY, T_MAP, T_FUNCTION and T_OBJECT sciter::value.
fn push<T: Into<Value>>(&mut self, src: T)
[src]
Append value to the end of T_ARRAY sciter::value.
fn set<T: Into<Value>>(&mut self, index: usize, src: T)
[src]
Insert or set value at given index
of T_ARRAY, T_MAP, T_FUNCTION and T_OBJECT sciter::value.
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 nth key/value pair in the map;
- T_FUNCTION - value of nth argument of the function.
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 sub-element by key.
- if it is a map - sets named value in the map;
- if it is a function - sets named argument of the function;
- if it is a object - sets value of property of the object;
- otherwise it converts this to map and adds key/v to it.
fn get_item<T: Into<Value>>(&self, key: T) -> Value
[src]
Retrieve value of sub-element by key.
fn to_int(&self) -> Option<i32>
[src]
Value to integer.
fn to_bool(&self) -> Option<bool>
[src]
Value to bool.
fn to_float(&self) -> Option<f64>
[src]
Value to float.
fn to_color(&self) -> Option<u32>
[src]
Value to color.
fn to_duration(&self) -> Option<f64>
[src]
Value to duration.
fn to_angle(&self) -> Option<f64>
[src]
Value to angle.
fn as_string(&self) -> Option<String>
[src]
Value as string for T_STRING type.
fn into_string(&mut self) -> String
[src]
Value to json string (converted in-place). Subject to change.
fn as_bytes(&self) -> Option<&[u8]>
[src]
Value as byte slice for T_BYTES type.
fn to_bytes(&self) -> Option<Vec<u8>>
[src]
Value to byte vector for T_BYTES type.
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/UT_OBJECT_FUNCTION.
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).
name
here is an url or name of the script - used for error reporting in the script.
You can use the make_args!(a,b,c)
macro which help you construct script arguments from Rust types.
fn is_undefined(&self) -> bool
[src]
fn is_null(&self) -> bool
[src]
fn is_bool(&self) -> bool
[src]
fn is_int(&self) -> bool
[src]
fn is_float(&self) -> bool
[src]
fn is_bytes(&self) -> bool
[src]
fn is_string(&self) -> bool
[src]
fn is_symbol(&self) -> bool
[src]
fn is_error_string(&self) -> bool
[src]
fn is_date(&self) -> bool
[src]
fn is_currency(&self) -> bool
[src]
fn is_color(&self) -> bool
[src]
fn is_duration(&self) -> bool
[src]
fn is_angle(&self) -> bool
[src]
fn is_map(&self) -> bool
[src]
fn is_array(&self) -> bool
[src]
fn is_function(&self) -> bool
[src]
fn is_native_function(&self) -> bool
[src]
fn is_object(&self) -> bool
[src]
fn is_dom_element(&self) -> bool
[src]
Trait Implementations
impl Send for Value
[src]
sciter::Value
can be transferred across thread boundaries.
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.
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<'a>(&'a self, index: usize) -> &'a 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<'a>(&'a self, key: Value) -> &'a 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<'a>(&'a self, key: &'static str) -> &'a 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.