pub struct OwnedJsonb { /* private fields */ }Expand description
Represents a JSONB data that owns its underlying data.
This struct provides ownership over the binary JSONB representation.
OwnedJsonb is primarily used to create JSONB data from other data types (such as JSON String).
However, for most operations, it’s necessary to convert an OwnedJsonb to a RawJsonb using the as_raw() method
to avoid unnecessary copying and to take advantage of the performance benefits of the read-only access of the RawJsonb.
Implementations§
Trait Implementations§
Source§impl AsRef<[u8]> for OwnedJsonb
Allows accessing the underlying byte slice as a reference.
This enables easy integration with functions that expect a &[u8].
impl AsRef<[u8]> for OwnedJsonb
Allows accessing the underlying byte slice as a reference.
This enables easy integration with functions that expect a &[u8].
Source§impl Clone for OwnedJsonb
impl Clone for OwnedJsonb
Source§impl Debug for OwnedJsonb
impl Debug for OwnedJsonb
Source§impl Display for OwnedJsonb
Implements the Display trait, allowing OwnedJsonb to be formatted as a string using the {} format specifier.
impl Display for OwnedJsonb
Implements the Display trait, allowing OwnedJsonb to be formatted as a string using the {} format specifier.
impl Eq for OwnedJsonb
Source§impl From<&[u8]> for OwnedJsonb
Creates an OwnedJsonb from a borrowed byte slice. The byte slice is copied into a new Vec<u8>.
impl From<&[u8]> for OwnedJsonb
Creates an OwnedJsonb from a borrowed byte slice. The byte slice is copied into a new Vec<u8>.
Source§impl From<Vec<u8>> for OwnedJsonb
Creates an OwnedJsonb from a Vec<u8>. This is a simple ownership transfer.
impl From<Vec<u8>> for OwnedJsonb
Creates an OwnedJsonb from a Vec<u8>. This is a simple ownership transfer.
Source§impl FromStr for OwnedJsonb
Parses a string into an OwnedJsonb.
The string is parsed into a JSON value, then encoded into the binary JSONB format.
impl FromStr for OwnedJsonb
Parses a string into an OwnedJsonb.
The string is parsed into a JSON value, then encoded into the binary JSONB format.
Source§impl Ord for OwnedJsonb
Implements Ord for OwnedJsonb, allowing comparison of two OwnedJsonb values using the total ordering.
This implementation leverages the PartialOrd implementation, returning Ordering::Equal for incomparable values.
impl Ord for OwnedJsonb
Implements Ord for OwnedJsonb, allowing comparison of two OwnedJsonb values using the total ordering.
This implementation leverages the PartialOrd implementation, returning Ordering::Equal for incomparable values.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for OwnedJsonb
impl PartialEq for OwnedJsonb
Source§impl PartialOrd for OwnedJsonb
Implements PartialOrd for OwnedJsonb, allowing comparison of two OwnedJsonb values.
impl PartialOrd for OwnedJsonb
Implements PartialOrd for OwnedJsonb, allowing comparison of two OwnedJsonb values.
The comparison logic handles different JSONB types (scalar, array, object) and considers null values. The ordering is defined as follows:
- Null is considered greater than any other type.
- Scalars are compared based on their type and value (String > Number > Boolean).
- Arrays are compared element by element.
- Objects are compared based on their keys and values.
- Arrays are greater than objects and scalars.
- Objects are greater than scalars.
- If the types are incompatible, None is returned.