[−][src]Struct sciter::value::Value
sciter::value
wrapper.
See the module-level documentation.
Implementations
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 nothing() -> Value
[src]
Make an explicit nothing
(where did it come from?).
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 to_asset<T>(&self) -> Option<&mut IAsset<T>>
[src]
Value to asset.
pub fn as_mut_ptr(&mut self) -> *mut VALUE
[src]
Returns a raw pointer to the underlaying data.
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(&mut self)
[src]
Convert T_OBJECT
value type to JSON T_MAP
or T_ARRAY
types.
Also must be used if you need 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
.
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).
The iterator element type is Value
(as a key).
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.
The iterator element type is Value
.
pub fn items(&self) -> Vec<(Value, Value)>
[src]
An iterator visiting all key-value pairs in arbitrary order.
The Value
must has a key-value type (map, object, function).
The iterator element type is (Value, Value)
.
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_nothing(&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_asset(&self) -> bool
[src]
pub fn is_object_array(&self) -> bool
[src]
pub fn is_object_map(&self) -> bool
[src]
pub fn is_object_class(&self) -> bool
[src]
pub fn is_object_native(&self) -> bool
[src]
pub fn is_object_function(&self) -> bool
[src]
pub fn is_object_error(&self) -> bool
[src]
pub fn is_dom_element(&self) -> bool
[src]
pub fn is_varray(&self) -> bool
[src]
pub fn is_vmap(&self) -> bool
[src]
pub fn is_vfunction(&self) -> bool
[src]
pub fn is_verror(&self) -> bool
[src]
Trait Implementations
impl Clone for Value
[src]
Copies value.
All allocated objects are reference counted so copying is just a matter of increasing reference counts.
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Value
[src]
Print Value
as json string with explicit type showed.
impl Default for Value
[src]
Return default value (undefined
).
impl Display for Value
[src]
Print Value
as json string
impl Drop for Value
[src]
Destroy pointed value.
impl<'_> From<&'_ bool> for Value
[src]
Value from bool.
impl<'_> From<&'_ f64> for Value
[src]
Value from float.
impl<'_> From<&'_ i32> for Value
[src]
Value from integer.
impl<'a> From<&'a [u8]> for Value
[src]
Value from binary array (sequence of bytes).
impl<'a> From<&'a String> for Value
[src]
impl<'a> From<&'a VALUE> for Value
[src]
Value from a native VALUE
object.
impl<'a> From<&'a str> for Value
[src]
Value from string.
impl From<()> for Value
[src]
Value from nothing (()
) for empty return values.
Returns undefined
value.
impl<T> From<Box<IAsset<T>, Global>> for Value
[src]
Value from asset.
impl<F, R> From<F> for Value where
F: Fn(&[Value]) -> R,
R: Into<Value>,
[src]
F: Fn(&[Value]) -> R,
R: Into<Value>,
Value from function.
impl From<Graphics> for Value
[src]
Store the Graphics
object as a Value
.
impl From<Image> for Value
[src]
Store the Image
object as a Value
.
impl From<Path> for Value
[src]
Store the Path
object as a Value
.
impl<T, E> From<Result<T, E>> for Value where
T: Into<Value>,
E: Display,
[src]
T: Into<Value>,
E: Display,
impl From<String> for Value
[src]
Value from string.
impl From<Text> for Value
[src]
Store the Text
object as a Value
.
impl From<bool> for Value
[src]
Value from bool.
impl From<f64> for Value
[src]
Value from float.
impl From<i32> for Value
[src]
Value from integer.
impl<'a> FromIterator<&'a str> for Value
[src]
Value from sequence of &str
.
pub fn from_iter<I: IntoIterator<Item = &'a str>>(iterator: I) -> Self
[src]
impl FromIterator<String> for Value
[src]
Value from sequence of String
.
pub fn from_iter<I: IntoIterator<Item = String>>(iterator: I) -> Self
[src]
impl FromIterator<Value> for Value
[src]
Value from sequence of Value
.
pub fn from_iter<I: IntoIterator<Item = Value>>(iterator: I) -> Self
[src]
impl FromIterator<f64> for Value
[src]
Value from sequence of f64
.
pub fn from_iter<I: IntoIterator<Item = f64>>(iterator: I) -> Self
[src]
impl FromIterator<i32> for Value
[src]
Value from sequence of i32
.
pub fn from_iter<I: IntoIterator<Item = i32>>(iterator: I) -> Self
[src]
impl FromStr for Value
[src]
Value from json string.
type Err = VALUE_RESULT
The associated error which can be returned from parsing.
pub fn from_str(val: &str) -> Result<Self, Self::Err>
[src]
impl FromValue for Value
[src]
pub fn from_value(v: &Value) -> Option<Self>
[src]
impl Index<&'static str> for Value
[src]
Get item by string key for map type.
type Output = Value
The returned type after indexing.
pub fn index(&self, key: &'static str) -> &Self::Output
[src]
impl Index<Value> for Value
[src]
Get item by key for map type.
type Output = Value
The returned type after indexing.
pub fn index(&self, key: Value) -> &Self::Output
[src]
impl Index<usize> for Value
[src]
Get item by index for array type.
type Output = Value
The returned type after indexing.
pub fn index(&self, index: usize) -> &Self::Output
[src]
impl<'a> IntoIterator for &'a Value
[src]
Conversion into an Iterator
.
Adds the for
loop syntax support: for subitem in &value {]
.
type Item = Value
The type of the elements being iterated over.
type IntoIter = SeqIterator<'a>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> Self::IntoIter
[src]
impl PartialEq<Value> for Value
[src]
Compare two values.
pub fn eq(&self, other: &Self) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl Send for Value
[src]
sciter::Value
can be transferred across thread boundaries.
impl TryFrom<Element> for Value
[src]
Store the DOM element as a Value
.
Since 4.4.3.26, perhaps.
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,