A php value, can be either a bool, int, float, string or array
note that in php all arrays are associative and thus represented by a map in rust.
You can convert a Value
into a regular rust type by pattern matching or using the into_
functions.
If the value is a php array, you can directly index into the Value
, this will null if the Value
is not an array
or the key is not found
let value = Value::Array(hashmap!{
"key".into() => "value".into(),
10.into() => false.into()
});
assert_eq!(value["key"], "value");
assert_eq!(value[10], false);
assert!(value["not"]["found"].is_null());
Check if the value is a bool
Check if the value is an integer
Check if the value is a float
Check if the value is a string
Check if the value is an array
Check if the value is null
Convert the value into a bool if it is one
Convert the value into a int if it is one
Convert the value into a float if it is one
Convert the value into a string if it is one
Convert the value into a hashmap if it is one
Get the value as &str if it is a string
Get the value as i64 if it is an int
Get the value as f64 if it is a float
Iterate over array key and value pairs if it is an array
Iterate over array keys if it is an array
Iterate over array values if it is an array
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
The returned type after indexing.
Performs the indexing (container[index]
) operation. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<T> Any for T where
T: 'static + ?Sized,
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.