pub struct JsonField<'a, 'b> {
pub key: &'a str,
pub value: JsonValue<'b>,
}Expand description
a field within a JSON object
Fields§
§key: &'a str§value: JsonValue<'b>Implementations§
Source§impl<'a, 'b> JsonField<'a, 'b>
impl<'a, 'b> JsonField<'a, 'b>
Sourcepub const fn new(key: &'a str, value: JsonValue<'b>) -> Self
pub const fn new(key: &'a str, value: JsonValue<'b>) -> Self
create a new JSON object field with the given key & value
Sourcepub const fn from_tuple(tuple: (&'a str, JsonValue<'b>)) -> Self
pub const fn from_tuple(tuple: (&'a str, JsonValue<'b>)) -> Self
convenience helper to get the json field as a (key,value) tuple
Sourcepub const fn as_tuple(&self) -> (&'a str, JsonValue<'b>)
pub const fn as_tuple(&self) -> (&'a str, JsonValue<'b>)
convenience helper to get the json field as a (key,value) tuple
Sourcepub const fn new_string(key: &'a str, value: &'b str) -> Self
pub const fn new_string(key: &'a str, value: &'b str) -> Self
convenience helper to create a new JSON object string field
Sourcepub const fn new_number(key: &'a str, value: i64) -> Self
pub const fn new_number(key: &'a str, value: i64) -> Self
convenience helper to create a new JSON object number field
Sourcepub const fn new_boolean(key: &'a str, value: bool) -> Self
pub const fn new_boolean(key: &'a str, value: bool) -> Self
convenience helper to create a new JSON object boolean field
Trait Implementations§
impl<'a, 'b> Copy for JsonField<'a, 'b>
impl<'a, 'b> Eq for JsonField<'a, 'b>
impl<'a, 'b> StructuralPartialEq for JsonField<'a, 'b>
Auto Trait Implementations§
impl<'a, 'b> Freeze for JsonField<'a, 'b>
impl<'a, 'b> RefUnwindSafe for JsonField<'a, 'b>
impl<'a, 'b> Send for JsonField<'a, 'b>
impl<'a, 'b> Sync for JsonField<'a, 'b>
impl<'a, 'b> Unpin for JsonField<'a, 'b>
impl<'a, 'b> UnwindSafe for JsonField<'a, 'b>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more