casbin::rhai

Struct Dynamic

pub struct Dynamic(/* private fields */);
Expand description

Dynamic type containing any value.

Implementations§

§

impl Dynamic

pub fn as_string(self) -> Result<String, &'static str>

👎Deprecated since 1.1.0: use into_string instead

Convert the Dynamic into a String and return it. If there are other references to the same string, a cloned copy is returned. Returns the name of the actual type if the cast fails.

§Deprecated

This method is deprecated. Use into_string instead.

This method will be removed in the next major version.

pub fn as_immutable_string(self) -> Result<ImmutableString, &'static str>

👎Deprecated since 1.1.0: use into_immutable_string instead

Convert the Dynamic into an ImmutableString and return it. Returns the name of the actual type if the cast fails.

§Deprecated

This method is deprecated. Use into_immutable_string instead.

This method will be removed in the next major version.

§

impl Dynamic

pub const fn tag(&self) -> i32

Get the arbitrary data attached to this Dynamic.

pub fn set_tag(&mut self, value: i32) -> &mut Dynamic

Attach arbitrary data to this Dynamic.

pub const fn is_variant(&self) -> bool

Does this Dynamic hold a variant data type instead of one of the supported system primitive types?

pub fn is<T>(&self) -> bool
where T: Any + Clone,

Is the value held by this Dynamic a particular type?

§Panics or Deadlocks When Value is Shared

Under the sync feature, this call may deadlock, or panic. Otherwise, this call panics if the data is currently borrowed for write.

pub fn type_id(&self) -> TypeId

Get the TypeId of the value held by this Dynamic.

§Panics or Deadlocks When Value is Shared

Under the sync feature, this call may deadlock, or panic. Otherwise, this call panics if the data is currently borrowed for write.

pub fn type_name(&self) -> &'static str

Get the name of the type of the value held by this Dynamic.

§Panics or Deadlocks When Value is Shared

Under the sync feature, this call may deadlock, or panic. Otherwise, this call panics if the data is currently borrowed for write.

§

impl Dynamic

pub const UNIT: Dynamic = _

A Dynamic containing a ().

pub const TRUE: Dynamic = _

A Dynamic containing a true.

pub const FALSE: Dynamic = _

A Dynamic containing a false.

pub const ZERO: Dynamic = _

A Dynamic containing the integer zero.

pub const ONE: Dynamic = _

A Dynamic containing the integer 1.

pub const TWO: Dynamic = _

A Dynamic containing the integer 2.

pub const THREE: Dynamic = _

A Dynamic containing the integer 3.

pub const TEN: Dynamic = _

A Dynamic containing the integer 10.

pub const HUNDRED: Dynamic = _

A Dynamic containing the integer 100.

pub const THOUSAND: Dynamic = _

A Dynamic containing the integer 1,000.

pub const MILLION: Dynamic = _

A Dynamic containing the integer 1,000,000.

pub const NEGATIVE_ONE: Dynamic = _

A Dynamic containing the integer -1.

pub const NEGATIVE_TWO: Dynamic = _

A Dynamic containing the integer -2.

pub const fn from_bool(value: bool) -> Dynamic

Create a new Dynamic from a bool.

pub const fn from_int(value: i32) -> Dynamic

Create a new Dynamic from an INT.

pub const fn from_char(value: char) -> Dynamic

Create a new Dynamic from a char.

pub fn from_array(array: Vec<Dynamic>) -> Dynamic

Create a Dynamic from an Array.

pub fn from_blob(blob: Vec<u8>) -> Dynamic

Create a Dynamic from a Blob.

pub fn from_map(map: BTreeMap<SmartString<LazyCompact>, Dynamic>) -> Dynamic

Create a Dynamic from a Map.

pub fn from_timestamp(value: Instant) -> Dynamic

Create a new Dynamic from an Instant.

Not available under no-std or no_time.

pub fn into_read_only(self) -> Dynamic

Make this Dynamic read-only (i.e. a constant).

pub fn is_read_only(&self) -> bool

Is this Dynamic read-only?

Constant Dynamic values are read-only.

§Usage

If a &mut Dynamic to such a constant is passed to a Rust function, the function can use this information to return the error ErrorAssignmentToConstant if its value will be modified.

This safe-guards constant values from being modified within Rust functions.

§Shared Value

If a Dynamic holds a shared value, then it is read-only only if the shared value itself is read-only.

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its access mode cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn from<T>(value: T) -> Dynamic
where T: Variant + Clone,

Create a Dynamic from any type. A Dynamic value is simply returned as is.

§Arrays

Beware that you need to pass in an Array type for it to be recognized as an Array. A Vec<T> does not get automatically converted to an Array, but will be a custom type instead (stored as a trait object).

Use array.into() or array.into_iter() to convert a Vec<T> into a Dynamic as an Array value. See the examples for details.

§Hash Maps

Similarly, passing in a HashMap<String, T> or BTreeMap<String, T> will not get a Map but a custom type.

Again, use map.into() to get a Dynamic with a Map value. See the examples for details.

§Examples
use rhai::Dynamic;

let result = Dynamic::from(42_i64);
assert_eq!(result.type_name(), "i64");
assert_eq!(result.to_string(), "42");

let result = Dynamic::from("hello");
assert_eq!(result.type_name(), "string");
assert_eq!(result.to_string(), "hello");

let new_result = Dynamic::from(result);
assert_eq!(new_result.type_name(), "string");
assert_eq!(new_result.to_string(), "hello");

// Arrays - this is a custom object!
let result = Dynamic::from(vec![1_i64, 2, 3]);
assert_eq!(result.type_name(), "alloc::vec::Vec<i64>");

// Use '.into()' to convert a Vec<T> into an Array
let result: Dynamic = vec![1_i64, 2, 3].into();
assert_eq!(result.type_name(), "array");

// Hash map
let mut map = HashMap::new();
map.insert("a".to_string(), 1_i64);

// This is a custom object!
let result = Dynamic::from(map.clone());
assert_eq!(result.type_name(), "std::collections::hash::map::HashMap<alloc::string::String, i64>");

// Use '.into()' to convert a HashMap<String, T> into an object map
let result: Dynamic = map.into();
assert_eq!(result.type_name(), "map");

pub fn take(&mut self) -> Dynamic

Return this Dynamic, replacing it with Dynamic::UNIT.

pub fn try_cast<T>(self) -> Option<T>
where T: Any,

Convert the Dynamic value into specific type.

Casting to a Dynamic simply returns itself.

§Errors

Returns None if types mismatch.

§Shared Value

If the Dynamic is a shared value, it returns the shared value if there are no outstanding references, or a cloned copy otherwise.

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

§Example
use rhai::Dynamic;

let x = Dynamic::from(42_u32);

assert_eq!(x.try_cast::<u32>().expect("x should be u32"), 42);

pub fn try_cast_result<T>(self) -> Result<T, Dynamic>
where T: Any,

Convert the Dynamic value into specific type.

Casting to a Dynamic simply returns itself.

§Errors

Returns itself as an error if types mismatch.

§Shared Value

If the Dynamic is a shared value, it returns the shared value if there are no outstanding references, or a cloned copy otherwise.

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn cast<T>(self) -> T
where T: Any + Clone,

Convert the Dynamic value into a specific type.

Casting to a Dynamic just returns as is.

§Panics

Panics if the cast fails (e.g. the type of the actual value is not the same as the specified type).

§Shared Value

If the Dynamic is a shared value, it returns the shared value if there are no outstanding references, or a cloned copy otherwise.

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the shared value is simply cloned, which means that the returned value is also shared.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

§Example
use rhai::Dynamic;

let x = Dynamic::from(42_u32);

assert_eq!(x.cast::<u32>(), 42);

pub fn clone_cast<T>(&self) -> T
where T: Any + Clone,

Clone the Dynamic value and convert it into a specific type.

Casting to a Dynamic just returns as is.

§Panics

Panics if the cast fails (e.g. the type of the actual value is not the same as the specified type).

§Shared Value

If the Dynamic is a shared value, a cloned copy of the shared value is returned.

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the shared value is simply cloned.

This normally shouldn’t occur since most operations in Rhai are single-threaded.

§Example
use rhai::Dynamic;

let x = Dynamic::from(42_u32);
let y = &x;

assert_eq!(y.clone_cast::<u32>(), 42);

pub fn flatten_clone(&self) -> Dynamic

Flatten the Dynamic and clone it.

If the Dynamic is not a shared value, a cloned copy is returned.

If the Dynamic is a shared value, a cloned copy of the shared value is returned.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the shared value is simply cloned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn flatten(self) -> Dynamic

Flatten the Dynamic.

If the Dynamic is not a shared value, it simply returns itself.

If the Dynamic is a shared value, it returns the shared value if there are no outstanding references, or a cloned copy otherwise.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the shared value is simply cloned, meaning that the result value will also be shared.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn read_lock<T>(&self) -> Option<DynamicReadLock<'_, T>>
where T: Any + Clone,

Get a reference of a specific type to the Dynamic.

Casting to Dynamic just returns a reference to it.

Returns None if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, this call also fails if the data is currently borrowed for write.

Under these circumstances, None is also returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn write_lock<T>(&mut self) -> Option<DynamicWriteLock<'_, T>>
where T: Any + Clone,

Get a mutable reference of a specific type to the Dynamic.

Casting to Dynamic just returns a mutable reference to it.

Returns None if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, this call also fails if the data is currently borrowed for write.

Under these circumstances, None is also returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_unit(&self) -> bool

Return true if the Dynamic holds a ().

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_int(&self) -> bool

Return true if the Dynamic holds the system integer type INT.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_bool(&self) -> bool

Return true if the Dynamic holds a bool.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_char(&self) -> bool

Return true if the Dynamic holds a char.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_string(&self) -> bool

Return true if the Dynamic holds an ImmutableString.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_array(&self) -> bool

Return true if the Dynamic holds an Array.

Not available under no_index.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_blob(&self) -> bool

Return true if the Dynamic holds a Blob.

Not available under no_index.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_map(&self) -> bool

Return true if the Dynamic holds a Map.

Not available under no_object.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_fnptr(&self) -> bool

Return true if the Dynamic holds a FnPtr.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn is_timestamp(&self) -> bool

Return true if the Dynamic holds a timestamp.

Not available under no_time.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, false is returned.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_unit(&self) -> Result<(), &'static str>

Cast the Dynamic as a unit ().

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_int(&self) -> Result<i32, &'static str>

Cast the Dynamic as the system integer type INT.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_bool(&self) -> Result<bool, &'static str>

Cast the Dynamic as a bool.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_char(&self) -> Result<char, &'static str>

Cast the Dynamic as a char.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_immutable_string_ref( &self, ) -> Result<impl Deref<Target = ImmutableString>, &'static str>

Cast the Dynamic as an ImmutableString.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_immutable_string_mut(&mut self) -> Result<impl DerefMut, &'static str>

Cast the Dynamic as a mutable reference to an ImmutableString.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_array_ref( &self, ) -> Result<impl Deref<Target = Vec<Dynamic>>, &'static str>

Cast the Dynamic as an Array.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_array_mut(&mut self) -> Result<impl DerefMut, &'static str>

Cast the Dynamic as a mutable reference to an Array.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_blob_ref(&self) -> Result<impl Deref<Target = Vec<u8>>, &'static str>

Cast the Dynamic as a Blob.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_blob_mut(&mut self) -> Result<impl DerefMut, &'static str>

Cast the Dynamic as a mutable reference to a Blob.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_map_ref( &self, ) -> Result<impl Deref<Target = BTreeMap<SmartString<LazyCompact>, Dynamic>>, &'static str>

Cast the Dynamic as a Map.

Not available under no_object.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn as_map_mut(&mut self) -> Result<impl DerefMut, &'static str>

Cast the Dynamic as a mutable reference to a Map.

Not available under no_object.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn into_string(self) -> Result<String, &'static str>

Convert the Dynamic into a String.

If there are other references to the same string, a cloned copy is returned.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn into_immutable_string(self) -> Result<ImmutableString, &'static str>

Convert the Dynamic into an ImmutableString.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn into_array(self) -> Result<Vec<Dynamic>, &'static str>

Convert the Dynamic into an Array.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn into_typed_array<T>(self) -> Result<Vec<T>, &'static str>
where T: Variant + Clone,

Convert the Dynamic into a Vec.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn into_blob(self) -> Result<Vec<u8>, &'static str>

Convert the Dynamic into a Blob.

Not available under no_index.

§Errors

Returns the name of the actual type as an error if the cast fails.

§Shared Value

Under the sync feature, a shared value may deadlock. Otherwise, the data may currently be borrowed for write (so its type cannot be determined).

Under these circumstances, the cast also fails.

These normally shouldn’t occur since most operations in Rhai are single-threaded.

pub fn deep_scan(&mut self, filter: impl FnMut(&mut Dynamic))

Recursively scan for Dynamic values within this Dynamic (e.g. items in an array or map), calling a filter function on each.

§Shared Value

Shared values are NOT scanned.

Trait Implementations§

§

impl Clone for Dynamic

§

fn clone(&self) -> Dynamic

Clone the Dynamic value.

§WARNING

The cloned copy is marked read-write even if the original is read-only.

1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Dynamic

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Dynamic

§

fn default() -> Dynamic

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for Dynamic

§

fn deserialize<D>( deserializer: D, ) -> Result<Dynamic, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for Dynamic

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Extend<Dynamic> for FnPtr

§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = Dynamic>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
§

impl<T> From<&[T]> for Dynamic
where T: Variant + Clone,

§

fn from(value: &[T]) -> Dynamic

Converts to this type from the input type.
§

impl From<()> for Dynamic

§

fn from(value: ()) -> Dynamic

Converts to this type from the input type.
§

impl<K, T> From<BTreeMap<K, T>> for Dynamic
where K: Into<SmartString<LazyCompact>>, T: Variant + Clone,

§

fn from(value: BTreeMap<K, T>) -> Dynamic

Converts to this type from the input type.
§

impl<K> From<BTreeSet<K>> for Dynamic
where K: Into<SmartString<LazyCompact>>,

§

fn from(value: BTreeSet<K>) -> Dynamic

Converts to this type from the input type.
§

impl From<FnPtr> for Dynamic

§

fn from(value: FnPtr) -> Dynamic

Converts to this type from the input type.
§

impl<K, T> From<HashMap<K, T>> for Dynamic
where K: Into<SmartString<LazyCompact>>, T: Variant + Clone,

§

fn from(value: HashMap<K, T>) -> Dynamic

Converts to this type from the input type.
§

impl<K> From<HashSet<K>> for Dynamic
where K: Into<SmartString<LazyCompact>>,

§

fn from(value: HashSet<K>) -> Dynamic

Converts to this type from the input type.
§

impl From<Instant> for Dynamic

§

fn from(value: Instant) -> Dynamic

Converts to this type from the input type.
§

impl From<Range<i32>> for Dynamic

§

fn from(value: Range<i32>) -> Dynamic

Converts to this type from the input type.
§

impl From<RangeInclusive<i32>> for Dynamic

§

fn from(value: RangeInclusive<i32>) -> Dynamic

Converts to this type from the input type.
§

impl<S> From<S> for Dynamic

§

fn from(value: S) -> Dynamic

Converts to this type from the input type.
§

impl<T> From<Vec<T>> for Dynamic
where T: Variant + Clone,

§

fn from(value: Vec<T>) -> Dynamic

Converts to this type from the input type.
§

impl From<bool> for Dynamic

§

fn from(value: bool) -> Dynamic

Converts to this type from the input type.
§

impl From<char> for Dynamic

§

fn from(value: char) -> Dynamic

Converts to this type from the input type.
§

impl From<i32> for Dynamic

§

fn from(value: i32) -> Dynamic

Converts to this type from the input type.
§

impl<T> FromIterator<T> for Dynamic
where T: Variant + Clone,

§

fn from_iter<X>(iter: X) -> Dynamic
where X: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
§

impl FromStr for Dynamic

§

type Err = ()

The associated error which can be returned from parsing.
§

fn from_str(value: &str) -> Result<Dynamic, <Dynamic as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl Hash for Dynamic

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Hash the Dynamic value.

§Panics

Panics if the Dynamic value contains an unrecognized trait object.

1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<'de> IntoDeserializer<'de, Box<EvalAltResult>> for &'de Dynamic

§

type Deserializer = DynamicDeserializer<'de>

The type of the deserializer being converted into.
§

fn into_deserializer( self, ) -> <&'de Dynamic as IntoDeserializer<'de, Box<EvalAltResult>>>::Deserializer

Convert this value into a deserializer.
§

impl Serialize for Dynamic

§

fn serialize<S>( &self, ser: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,