pub trait JsonObjectExt {
Show 64 methods // Required methods fn get_bool(&self, key: &str) -> Option<bool>; fn get_u8(&self, key: &str) -> Option<u8>; fn get_u16(&self, key: &str) -> Option<u16>; fn get_u32(&self, key: &str) -> Option<u32>; fn get_u64(&self, key: &str) -> Option<u64>; fn get_usize(&self, key: &str) -> Option<usize>; fn get_i8(&self, key: &str) -> Option<i8>; fn get_i16(&self, key: &str) -> Option<i16>; fn get_i32(&self, key: &str) -> Option<i32>; fn get_i64(&self, key: &str) -> Option<i64>; fn get_isize(&self, key: &str) -> Option<isize>; fn get_f32(&self, key: &str) -> Option<f32>; fn get_f64(&self, key: &str) -> Option<f64>; fn get_str(&self, key: &str) -> Option<&str>; fn get_uuid(&self, key: &str) -> Option<Uuid>; fn get_date(&self, key: &str) -> Option<Date>; fn get_time(&self, key: &str) -> Option<Time>; fn get_datetime(&self, key: &str) -> Option<DateTime>; fn get_duration(&self, key: &str) -> Option<Duration>; fn get_array(&self, key: &str) -> Option<&Vec<JsonValue>>; fn get_u64_array(&self, key: &str) -> Option<Vec<u64>>; fn get_i64_array(&self, key: &str) -> Option<Vec<i64>>; fn get_f32_array(&self, key: &str) -> Option<Vec<f32>>; fn get_f64_array(&self, key: &str) -> Option<Vec<f64>>; fn get_str_array(&self, key: &str) -> Option<Vec<&str>>; fn get_map_array(&self, key: &str) -> Option<Vec<&Map>>; fn get_object(&self, key: &str) -> Option<&Map>; fn parse_bool(&self, key: &str) -> Option<Result<bool, ParseBoolError>>; fn parse_u8(&self, key: &str) -> Option<Result<u8, ParseIntError>>; fn parse_u16(&self, key: &str) -> Option<Result<u16, ParseIntError>>; fn parse_u32(&self, key: &str) -> Option<Result<u32, ParseIntError>>; fn parse_u64(&self, key: &str) -> Option<Result<u64, ParseIntError>>; fn parse_usize(&self, key: &str) -> Option<Result<usize, ParseIntError>>; fn parse_i8(&self, key: &str) -> Option<Result<i8, ParseIntError>>; fn parse_i16(&self, key: &str) -> Option<Result<i16, ParseIntError>>; fn parse_i32(&self, key: &str) -> Option<Result<i32, ParseIntError>>; fn parse_i64(&self, key: &str) -> Option<Result<i64, ParseIntError>>; fn parse_isize(&self, key: &str) -> Option<Result<isize, ParseIntError>>; fn parse_f32(&self, key: &str) -> Option<Result<f32, ParseFloatError>>; fn parse_f64(&self, key: &str) -> Option<Result<f64, ParseFloatError>>; fn parse_string(&self, key: &str) -> Option<Cow<'_, str>>; fn parse_array<T: FromStr>(&self, key: &str) -> Option<Vec<T>>; fn parse_str_array(&self, key: &str) -> Option<Vec<&str>>; fn parse_enum_values(&self, key: &str) -> Option<Vec<JsonValue>>; fn parse_object(&self, key: &str) -> Option<&Map>; fn parse_uuid(&self, key: &str) -> Option<Result<Uuid, Error>>; fn parse_decimal(&self, key: &str) -> Option<Result<Decimal, Error>>; fn parse_date(&self, key: &str) -> Option<Result<Date, ParseError>>; fn parse_time(&self, key: &str) -> Option<Result<Time, ParseError>>; fn parse_datetime(&self, key: &str) -> Option<Result<DateTime, ParseError>>; fn parse_duration( &self, key: &str ) -> Option<Result<Duration, ParseDurationError>>; fn parse_url(&self, key: &str) -> Option<Result<Url, ParseError>>; fn parse_ip(&self, key: &str) -> Option<Result<IpAddr, AddrParseError>>; fn parse_ipv4(&self, key: &str) -> Option<Result<Ipv4Addr, AddrParseError>>; fn parse_ipv6(&self, key: &str) -> Option<Result<Ipv6Addr, AddrParseError>>; fn pointer(&self, pointer: &str) -> Option<&JsonValue>; fn upsert( &mut self, key: impl Into<String>, value: impl Into<JsonValue> ) -> Option<JsonValue>; fn to_query_string(&self) -> String; fn into_avro_record(self) -> Record; fn from_entry(key: impl Into<String>, value: impl Into<JsonValue>) -> Self; fn data_entry(value: Map) -> Self; fn data_entries(values: Vec<Map>) -> Self; fn data_item(value: impl Into<JsonValue>) -> Self; fn data_items<T: Into<JsonValue>>(values: Vec<T>) -> Self;
}
Expand description

Extension trait for Map.

Required Methods§

source

fn get_bool(&self, key: &str) -> Option<bool>

Extracts the boolean value corresponding to the key.

source

fn get_u8(&self, key: &str) -> Option<u8>

Extracts the integer value corresponding to the key and represents it as u8 if possible.

source

fn get_u16(&self, key: &str) -> Option<u16>

Extracts the integer value corresponding to the key and represents it as u16 if possible.

source

fn get_u32(&self, key: &str) -> Option<u32>

Extracts the integer value corresponding to the key and represents it as u32 if possible.

source

fn get_u64(&self, key: &str) -> Option<u64>

Extracts the integer value corresponding to the key and represents it as u64 if possible.

source

fn get_usize(&self, key: &str) -> Option<usize>

Extracts the integer value corresponding to the key and represents it as usize if possible.

source

fn get_i8(&self, key: &str) -> Option<i8>

Extracts the integer value corresponding to the key and represents it as i8 if possible.

source

fn get_i16(&self, key: &str) -> Option<i16>

Extracts the integer value corresponding to the key and represents it as i16 if possible.

source

fn get_i32(&self, key: &str) -> Option<i32>

Extracts the integer value corresponding to the key and represents it as i32 if possible.

source

fn get_i64(&self, key: &str) -> Option<i64>

Extracts the integer value corresponding to the key.

source

fn get_isize(&self, key: &str) -> Option<isize>

Extracts the integer value corresponding to the key and represents it as isize if possible.

source

fn get_f32(&self, key: &str) -> Option<f32>

Extracts the float value corresponding to the key and represents it as f32 if possible.

source

fn get_f64(&self, key: &str) -> Option<f64>

Extracts the float value corresponding to the key.

source

fn get_str(&self, key: &str) -> Option<&str>

Extracts the string corresponding to the key.

source

fn get_uuid(&self, key: &str) -> Option<Uuid>

Extracts the string corresponding to the key and represents it as Uuid if possible.

source

fn get_date(&self, key: &str) -> Option<Date>

Extracts the string corresponding to the key and represents it as Date if possible.

source

fn get_time(&self, key: &str) -> Option<Time>

Extracts the string corresponding to the key and represents it as Time if possible.

source

fn get_datetime(&self, key: &str) -> Option<DateTime>

Extracts the string corresponding to the key and represents it as DateTime if possible.

source

fn get_duration(&self, key: &str) -> Option<Duration>

Extracts the string corresponding to the key and represents it as Duration if possible.

source

fn get_array(&self, key: &str) -> Option<&Vec<JsonValue>>

Extracts the array value corresponding to the key.

source

fn get_u64_array(&self, key: &str) -> Option<Vec<u64>>

Extracts the array value corresponding to the key and parses it as Vec<u64>.

source

fn get_i64_array(&self, key: &str) -> Option<Vec<i64>>

Extracts the array value corresponding to the key and parses it as Vec<i64>.

source

fn get_f32_array(&self, key: &str) -> Option<Vec<f32>>

Extracts the array value corresponding to the key and parses it as Vec<f32>.

source

fn get_f64_array(&self, key: &str) -> Option<Vec<f64>>

Extracts the array value corresponding to the key and parses it as Vec<f64>.

source

fn get_str_array(&self, key: &str) -> Option<Vec<&str>>

Extracts the array value corresponding to the key and parses it as Vec<&str>.

source

fn get_map_array(&self, key: &str) -> Option<Vec<&Map>>

Extracts the array value corresponding to the key and parses it as Vec<&Map>.

source

fn get_object(&self, key: &str) -> Option<&Map>

Extracts the object value corresponding to the key.

source

fn parse_bool(&self, key: &str) -> Option<Result<bool, ParseBoolError>>

Extracts the value corresponding to the key and parses it as bool.

source

fn parse_u8(&self, key: &str) -> Option<Result<u8, ParseIntError>>

Extracts the value corresponding to the key and parses it as u8.

source

fn parse_u16(&self, key: &str) -> Option<Result<u16, ParseIntError>>

Extracts the value corresponding to the key and parses it as u16.

source

fn parse_u32(&self, key: &str) -> Option<Result<u32, ParseIntError>>

Extracts the value corresponding to the key and parses it as u32.

source

fn parse_u64(&self, key: &str) -> Option<Result<u64, ParseIntError>>

Extracts the value corresponding to the key and parses it as u64.

source

fn parse_usize(&self, key: &str) -> Option<Result<usize, ParseIntError>>

Extracts the value corresponding to the key and parses it as usize.

source

fn parse_i8(&self, key: &str) -> Option<Result<i8, ParseIntError>>

Extracts the value corresponding to the key and parses it as i8.

source

fn parse_i16(&self, key: &str) -> Option<Result<i16, ParseIntError>>

Extracts the value corresponding to the key and parses it as i16.

source

fn parse_i32(&self, key: &str) -> Option<Result<i32, ParseIntError>>

Extracts the value corresponding to the key and parses it as i32.

source

fn parse_i64(&self, key: &str) -> Option<Result<i64, ParseIntError>>

Extracts the value corresponding to the key and parses it as i64.

source

fn parse_isize(&self, key: &str) -> Option<Result<isize, ParseIntError>>

Extracts the value corresponding to the key and parses it as isize.

source

fn parse_f32(&self, key: &str) -> Option<Result<f32, ParseFloatError>>

Extracts the value corresponding to the key and parses it as f32.

source

fn parse_f64(&self, key: &str) -> Option<Result<f64, ParseFloatError>>

Extracts the value corresponding to the key and parses it as f64.

source

fn parse_string(&self, key: &str) -> Option<Cow<'_, str>>

Extracts the value corresponding to the key and parses it as Cow<'_, str>. If the str is empty, it also returns None.

source

fn parse_array<T: FromStr>(&self, key: &str) -> Option<Vec<T>>

Extracts the array value corresponding to the key and parses it as Vec<T>. If the vec is empty, it also returns None.

source

fn parse_str_array(&self, key: &str) -> Option<Vec<&str>>

Extracts the array value corresponding to the key and parses it as Vec<&str>. If the vec is empty, it also returns None.

source

fn parse_enum_values(&self, key: &str) -> Option<Vec<JsonValue>>

Extracts the enum values corresponding to the key and parses it as Vec<i64> or Vec<String>. If the vec is empty, it also returns None.

source

fn parse_object(&self, key: &str) -> Option<&Map>

Extracts the object value corresponding to the key and parses it as Map. If the map is empty, it also returns None.

source

fn parse_uuid(&self, key: &str) -> Option<Result<Uuid, Error>>

Extracts the string corresponding to the key and parses it as Uuid. If the Uuid is nil, it also returns None.

source

fn parse_decimal(&self, key: &str) -> Option<Result<Decimal, Error>>

Extracts the string corresponding to the key and parses it as Decimal.

source

fn parse_date(&self, key: &str) -> Option<Result<Date, ParseError>>

Extracts the string corresponding to the key and parses it as Date.

source

fn parse_time(&self, key: &str) -> Option<Result<Time, ParseError>>

Extracts the string corresponding to the key and parses it as Time.

source

fn parse_datetime(&self, key: &str) -> Option<Result<DateTime, ParseError>>

Extracts the string corresponding to the key and parses it as DateTime.

source

fn parse_duration( &self, key: &str ) -> Option<Result<Duration, ParseDurationError>>

Extracts the string corresponding to the key and parses it as Duration.

source

fn parse_url(&self, key: &str) -> Option<Result<Url, ParseError>>

Extracts the string corresponding to the key and parses it as Url.

source

fn parse_ip(&self, key: &str) -> Option<Result<IpAddr, AddrParseError>>

Extracts the string corresponding to the key and parses it as IpAddr.

source

fn parse_ipv4(&self, key: &str) -> Option<Result<Ipv4Addr, AddrParseError>>

Extracts the string corresponding to the key and parses it as Ipv4Addr.

source

fn parse_ipv6(&self, key: &str) -> Option<Result<Ipv6Addr, AddrParseError>>

Extracts the string corresponding to the key and parses it as Ipv6Addr.

source

fn pointer(&self, pointer: &str) -> Option<&JsonValue>

Looks up a value by a JSON Pointer.

A Pointer is a Unicode string with the reference tokens separated by /. Inside tokens / is replaced by ~1 and ~ is replaced by ~0. The addressed value is returned and if there is no such value None is returned.

source

fn upsert( &mut self, key: impl Into<String>, value: impl Into<JsonValue> ) -> Option<JsonValue>

Inserts or updates a pair into the map. If the map did have this key present, the value is updated and the old value is returned, otherwise None is returned.

source

fn to_query_string(&self) -> String

Serializes the map into a query string.

source

fn into_avro_record(self) -> Record

Consumes self and constructs an Avro record value.

source

fn from_entry(key: impl Into<String>, value: impl Into<JsonValue>) -> Self

Creates a new instance with the entry.

source

fn data_entry(value: Map) -> Self

Creates a new instance with a single key entry.

source

fn data_entries(values: Vec<Map>) -> Self

Creates a new instance with the entries.

source

fn data_item(value: impl Into<JsonValue>) -> Self

Creates a new instance with a single key item.

source

fn data_items<T: Into<JsonValue>>(values: Vec<T>) -> Self

Creates a new instance with the items.

Object Safety§

This trait is not object safe.

Implementors§