Lines Matching refs:from

163     /// assert_eq!(value, JsonValue::String(String::from("Hello World")));
174 let result = Self::String(JsonString::from(str));
365 /// assert_eq!(number_value.try_as_number().unwrap(), &Number::from(0.0));
389 /// assert_eq!(string_value.try_as_string().unwrap(), &String::from("Hello World"));
467 /// assert_eq!(number_value.try_as_mut_number().unwrap(), &mut Number::from(0.0));
491 /// assert_eq!(string_value.try_as_mut_string().unwrap(), &mut String::from("Hello World"));
573 /// assert_eq!(number_value.try_into_number().unwrap(), Number::from(0.0));
598 /// assert_eq!(string_value.try_into_string().unwrap(), String::from("Hello World"));
653 /// gets value of the member from the Object or Array.
660 /// object.insert(String::from("key"), "value".into());
672 /// Reads the contents from the file and Trys to deserialize to a JsonValue instance.
686 /// Gets the text from an object that implements the Read trait provided
702 /// Reads the text from a type that can be converted to [u8] and Trys to deserialize it to a Json instance.
802 /// Generates an instance of JsonValue from &str.
855 /// object1.insert(String::from("Key"), JsonValue::new_null());
858 /// object2.insert(String::from("Key"), JsonValue::new_number(0.0.into()));
889 /// Converts from &str to JsonValue.
897 fn from(t: &str) -> Self {
902 let result = Self::String(String::from(t));
908 /// Converts from String to JsonValue.
915 /// let value: JsonValue = String::from("Hello World").into();
919 fn from(t: JsonString) -> Self {
935 fn from(t: $type) -> Self {
949 fn from(t: &$type) -> Self {
963 fn from(t: &mut $type) -> Self {
983 fn from(t: $type) -> Self {
984 Self::Number(Number::from(t))
1657 /// UT test for `JsonValue::from`.
1663 /// 1. Calls `JsonValue::from` to create `JsonValue`s.
1667 assert_eq!(JsonValue::from(true), JsonValue::new_boolean(true));
1668 assert_eq!(JsonValue::from(false), JsonValue::new_boolean(false));
1670 JsonValue::from(Array::new()),
1674 JsonValue::from(Object::new()),
1678 assert_eq!(JsonValue::from(&true), JsonValue::new_boolean(true));
1679 assert_eq!(JsonValue::from(&false), JsonValue::new_boolean(false));
1681 JsonValue::from(&Array::new()),
1685 JsonValue::from(&Object::new()),
1689 assert_eq!(JsonValue::from(&mut true), JsonValue::new_boolean(true));
1690 assert_eq!(JsonValue::from(&mut false), JsonValue::new_boolean(false));
1692 JsonValue::from(&mut Array::new()),
1696 JsonValue::from(&mut Object::new()),
1701 assert_eq!(JsonValue::from(String::new()), JsonValue::new_string(""));
1707 JsonValue::from(CString::new("").unwrap()),