pub struct IValue(/* private fields */);Expand description
An interned JSON value.
Implementations§
Source§impl IValue
impl IValue
Sourcepub fn string(interners: &Jinterners, s: &str) -> Self
Available on crate feature sync only.
pub fn string(interners: &Jinterners, s: &str) -> Self
sync only.Interns a string JSON value.
See also string_mut(), which is more efficient if
you hold a mutable reference to the Jinterners arena as it avoids
acquiring locks.
Sourcepub fn string_mut(interners: &mut Jinterners, s: &str) -> Self
pub fn string_mut(interners: &mut Jinterners, s: &str) -> Self
Interns a string JSON value.
Contrary to string(), no locks are held internally
because this function already takes an exclusive mutable reference to
the Jinterners arena.
Sourcepub fn array(interners: &Jinterners, a: &[Self]) -> Self
Available on crate feature sync only.
pub fn array(interners: &Jinterners, a: &[Self]) -> Self
sync only.Interns a JSON array, whose items are already interned.
See also array_mut(), which is more efficient if
you hold a mutable reference to the Jinterners arena as it avoids
acquiring locks.
Sourcepub fn array_mut(interners: &mut Jinterners, a: &[Self]) -> Self
pub fn array_mut(interners: &mut Jinterners, a: &[Self]) -> Self
Interns a JSON array, whose items are already interned.
Contrary to array(), no locks are held internally
because this function already takes an exclusive mutable reference to
the Jinterners arena.
Sourcepub fn object<'a>(
interners: &Jinterners,
o: impl Iterator<Item = (&'a str, Self)>,
) -> Self
Available on crate feature sync only.
pub fn object<'a>( interners: &Jinterners, o: impl Iterator<Item = (&'a str, Self)>, ) -> Self
sync only.Interns a JSON object, whose values are already interned.
See also object_mut(), which is more efficient if
you hold a mutable reference to the Jinterners arena as it avoids
acquiring locks.
Sourcepub fn object_mut<'a>(
interners: &mut Jinterners,
o: impl Iterator<Item = (&'a str, Self)>,
) -> Self
pub fn object_mut<'a>( interners: &mut Jinterners, o: impl Iterator<Item = (&'a str, Self)>, ) -> Self
Interns a JSON object, whose values are already interned.
Contrary to object(), no locks are held internally
because this function already takes an exclusive mutable reference to
the Jinterners arena.
Sourcepub fn object_from_keys(
interners: &Jinterners,
o: impl Iterator<Item = (InternedStrKey, Self)>,
) -> Self
Available on crate feature sync only.
pub fn object_from_keys( interners: &Jinterners, o: impl Iterator<Item = (InternedStrKey, Self)>, ) -> Self
sync only.Interns a JSON object, whose keys and values are already interned.
See also object_from_keys_mut(), which
is more efficient if you hold a mutable reference to the Jinterners
arena as it avoids acquiring locks.
Sourcepub fn object_from_keys_mut(
interners: &mut Jinterners,
o: impl Iterator<Item = (InternedStrKey, Self)>,
) -> Self
pub fn object_from_keys_mut( interners: &mut Jinterners, o: impl Iterator<Item = (InternedStrKey, Self)>, ) -> Self
Interns a JSON object, whose keys and values are already interned.
Contrary to object_from_keys(), no locks are
held internally because this function already takes an exclusive mutable
reference to the Jinterners arena.
Sourcepub fn from_value<T>(value: T, interners: &Jinterners) -> Result<Self, Error>where
T: Serialize,
Available on crate features serde and sync only.
pub fn from_value<T>(value: T, interners: &Jinterners) -> Result<Self, Error>where
T: Serialize,
serde and sync only.Convert an arbitrary type into an IValue using that type’s
Serialize implementation.
See also from_value_mut(), which is more
efficient if you hold a mutable reference to the Jinterners arena as
it avoids acquiring locks.
Sourcepub fn from_value_mut<T>(
value: T,
interners: &mut Jinterners,
) -> Result<Self, Error>where
T: Serialize,
Available on crate feature serde only.
pub fn from_value_mut<T>(
value: T,
interners: &mut Jinterners,
) -> Result<Self, Error>where
T: Serialize,
serde only.Convert an arbitrary type into an IValue using that type’s
Serialize implementation.
Contrary to from_value(), no locks are held
internally because this function already takes an exclusive mutable
reference to the Jinterners arena.
Sourcepub fn to_value<'de, T>(&self, interners: &'de Jinterners) -> Result<T, Error>where
T: Deserialize<'de>,
Available on crate feature serde only.
pub fn to_value<'de, T>(&self, interners: &'de Jinterners) -> Result<T, Error>where
T: Deserialize<'de>,
serde only.Convert an IValue into an arbitrary type using that type’s
Deserialize implementation.
Sourcepub fn from_json_slice(
json: &[u8],
interners: &Jinterners,
) -> Result<Self, Error>
Available on crate features serde and sync only.
pub fn from_json_slice( json: &[u8], interners: &Jinterners, ) -> Result<Self, Error>
serde and sync only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializer to deserialize an interned value from a plain
JSON slice, using the provided Jinterners arena.
See also from_json_slice_mut(), which is
more efficient if you hold a mutable reference to the Jinterners
arena as it avoids acquiring locks.
Sourcepub fn from_json_str(json: &str, interners: &Jinterners) -> Result<Self, Error>
Available on crate features serde and sync only.
pub fn from_json_str(json: &str, interners: &Jinterners) -> Result<Self, Error>
serde and sync only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializer to deserialize an interned value from a plain
JSON string, using the provided Jinterners arena.
See also from_json_str_mut(), which is more
efficient if you hold a mutable reference to the Jinterners arena as
it avoids acquiring locks.
Sourcepub fn from_json_reader<R: Read>(
json: R,
interners: &Jinterners,
) -> Result<Self, Error>
Available on crate features serde and std and sync only.
pub fn from_json_reader<R: Read>( json: R, interners: &Jinterners, ) -> Result<Self, Error>
serde and std and sync only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializer to deserialize an interned value from a plain
JSON reader, using the provided Jinterners arena.
See also from_json_reader_mut(), which
is more efficient if you hold a mutable reference to the Jinterners
arena as it avoids acquiring locks.
Sourcepub fn from_json_slice_mut(
json: &[u8],
interners: &mut Jinterners,
) -> Result<Self, Error>
Available on crate feature serde only.
pub fn from_json_slice_mut( json: &[u8], interners: &mut Jinterners, ) -> Result<Self, Error>
serde only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializerMut to deserialize an interned value from a
plain JSON slice, using the provided Jinterners arena.
Contrary to from_json_slice(), no locks are
held internally because this function already takes an exclusive mutable
reference to the Jinterners arena.
Sourcepub fn from_json_str_mut(
json: &str,
interners: &mut Jinterners,
) -> Result<Self, Error>
Available on crate feature serde only.
pub fn from_json_str_mut( json: &str, interners: &mut Jinterners, ) -> Result<Self, Error>
serde only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializerMut to deserialize an interned value from a
plain JSON string, using the provided Jinterners arena.
Contrary to from_json_str(), no locks are held
internally because this function already takes an exclusive mutable
reference to the Jinterners arena.
Sourcepub fn from_json_reader_mut<R: Read>(
json: R,
interners: &mut Jinterners,
) -> Result<Self, Error>
Available on crate features serde and std only.
pub fn from_json_reader_mut<R: Read>( json: R, interners: &mut Jinterners, ) -> Result<Self, Error>
serde and std only.Convenience function to combine a serde_json::Deserializer with an
InterningDeserializerMut to deserialize an interned value from a
plain JSON reader, using the provided Jinterners arena.
Contrary to from_json_reader(), no locks are
held internally because this function already takes an exclusive mutable
reference to the Jinterners arena.
Sourcepub fn to_json_bytes(&self, interners: &Jinterners) -> Result<Vec<u8>, Error>
Available on crate feature serde only.
pub fn to_json_bytes(&self, interners: &Jinterners) -> Result<Vec<u8>, Error>
serde only.Convenience function to call serde_json::to_vec() on a
BoundValue combining this value with the given Jinterners.
Sourcepub fn to_json_bytes_pretty(
&self,
interners: &Jinterners,
) -> Result<Vec<u8>, Error>
Available on crate feature serde only.
pub fn to_json_bytes_pretty( &self, interners: &Jinterners, ) -> Result<Vec<u8>, Error>
serde only.Convenience function to call serde_json::to_vec_pretty() on a
BoundValue combining this value with the given Jinterners.
Sourcepub fn to_json_string(&self, interners: &Jinterners) -> Result<String, Error>
Available on crate feature serde only.
pub fn to_json_string(&self, interners: &Jinterners) -> Result<String, Error>
serde only.Convenience function to call serde_json::to_string() on a
BoundValue combining this value with the given Jinterners.
Sourcepub fn to_json_string_pretty(
&self,
interners: &Jinterners,
) -> Result<String, Error>
Available on crate feature serde only.
pub fn to_json_string_pretty( &self, interners: &Jinterners, ) -> Result<String, Error>
serde only.Convenience function to call serde_json::to_string_pretty() on a
BoundValue combining this value with the given Jinterners.
Sourcepub fn to_json_writer<W: Write>(
&self,
writer: W,
interners: &Jinterners,
) -> Result<(), Error>
Available on crate features serde and std only.
pub fn to_json_writer<W: Write>( &self, writer: W, interners: &Jinterners, ) -> Result<(), Error>
serde and std only.Convenience function to call serde_json::to_writer() on a
BoundValue combining this value with the given Jinterners.
Sourcepub fn to_json_writer_pretty<W: Write>(
&self,
writer: W,
interners: &Jinterners,
) -> Result<(), Error>
Available on crate features serde and std only.
pub fn to_json_writer_pretty<W: Write>( &self, writer: W, interners: &Jinterners, ) -> Result<(), Error>
serde and std only.Convenience function to call serde_json::to_writer_pretty() on a
BoundValue combining this value with the given Jinterners.
Trait Implementations§
impl Copy for IValue
Source§impl<'de> Deserialize<'de> for IValue
impl<'de> Deserialize<'de> for IValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IValue
Source§impl GetSize for IValue
impl GetSize for IValue
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Source§fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)
fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreSource§impl Ord for IValue
impl Ord for IValue
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for IValue
impl PartialOrd for IValue
impl StructuralPartialEq for IValue
Auto Trait Implementations§
impl Freeze for IValue
impl RefUnwindSafe for IValue
impl Send for IValue
impl Sync for IValue
impl Unpin for IValue
impl UnsafeUnpin for IValue
impl UnwindSafe for IValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.