Lines Matching refs:Array
19 pub use array::Array;
52 /// 5.Array: Array type
78 /// Array type
79 Array(Array),
103 Self::Array(a) => Display::fmt(a, f),
179 /// Creates an instance of JsonValue for Array type.
183 /// use ylong_json::{JsonValue, Array};
185 /// let value = JsonValue::new_array(Array::new());
186 /// assert_eq!(value, JsonValue::Array(Array::new()));
188 pub fn new_array(array: Array) -> Self {
189 Self::Array(array)
307 /// Determines whether JsonValue is Array type. Returns true if yes, false if no.
311 /// use ylong_json::{JsonValue, Array};
313 /// let array_value = JsonValue::new_array(Array::new());
320 matches!(*self, Self::Array(_))
403 /// Trys to convert JsonValue to a common reference of Array type. Conversion failure will return Error.
407 /// use ylong_json::{JsonValue, Array, Error};
409 /// let array_value = JsonValue::new_array(Array::new());
410 /// assert_eq!(array_value.try_as_array().unwrap(), &Array::new());
415 pub fn try_as_array(&self) -> Result<&Array, Error> {
417 Self::Array(array) => Ok(array),
505 /// Trys to convert JsonValue to a mutable reference of Array type. Conversion failure will return Error.
509 /// use ylong_json::{JsonValue, Error, Array};
511 /// let mut array_value = JsonValue::new_array(Array::new());
512 /// assert_eq!(array_value.try_as_mut_array().unwrap(), &mut Array::new());
517 pub fn try_as_mut_array(&mut self) -> Result<&mut Array, Error> {
519 Self::Array(array) => Ok(array),
612 /// Trys to convert JsonValue to Array type. This method transfers ownership.
617 /// use ylong_json::{JsonValue, Error, Array};
619 /// let array_value = JsonValue::new_array(Array::new());
620 /// assert_eq!(array_value.try_into_array().unwrap(), Array::new());
625 pub fn try_into_array(self) -> Result<Array, Error> {
627 Self::Array(array) => Ok(array),
652 /// Trys to remove a member form an Object or Array. If the member is found by Index,
653 /// gets value of the member from the Object or Array.
835 /// use ylong_json::{JsonValue, Array, Object};
841 /// assert_eq!(JsonValue::new_array(Array::new()), JsonValue::new_array(Array::new()));
847 /// let mut array1 = Array::new();
850 /// let mut array2 = Array::new();
867 (JsonValue::Array(a), JsonValue::Array(b)) => a == b,
992 json_value_from_type!(Array, JsonValue::new_array);
999 use super::{array::Array, object::Object, JsonValue};
1071 assert!(!JsonValue::new_array(Array::new()).is_null());
1091 assert!(!JsonValue::new_array(Array::new()).is_true());
1111 assert!(!JsonValue::new_array(Array::new()).is_false());
1131 assert!(!JsonValue::new_array(Array::new()).is_boolean());
1151 assert!(!JsonValue::new_array(Array::new()).is_number());
1171 assert!(!JsonValue::new_array(Array::new()).is_string());
1191 assert!(JsonValue::new_array(Array::new()).is_array());
1211 assert!(!JsonValue::new_array(Array::new()).is_object());
1233 assert!(JsonValue::new_array(Array::new()).try_as_boolean().is_err());
1255 assert!(JsonValue::new_array(Array::new()).try_as_number().is_err());
1277 assert!(JsonValue::new_array(Array::new()).try_as_string().is_err());
1299 assert!(JsonValue::new_array(Array::new()).try_as_array().is_ok());
1319 assert!(JsonValue::new_array(Array::new()).try_as_object().is_err());
1341 assert!(JsonValue::new_array(Array::new())
1367 assert!(JsonValue::new_array(Array::new())
1393 assert!(JsonValue::new_array(Array::new())
1419 assert!(JsonValue::new_array(Array::new())
1445 assert!(JsonValue::new_array(Array::new())
1471 assert!(JsonValue::new_array(Array::new())
1497 assert!(JsonValue::new_array(Array::new())
1523 assert!(JsonValue::new_array(Array::new())
1549 assert!(JsonValue::new_array(Array::new()).try_into_array().is_ok());
1573 assert!(JsonValue::new_array(Array::new())
1647 JsonValue::new_array(Array::new()),
1648 JsonValue::new_array(Array::new())
1670 JsonValue::from(Array::new()),
1671 JsonValue::new_array(Array::new())
1681 JsonValue::from(&Array::new()),
1682 JsonValue::new_array(Array::new())
1692 JsonValue::from(&mut Array::new()),
1693 JsonValue::new_array(Array::new())