pub struct HashableTomlValue { /* private fields */ }
Expand description
toml::Value is not Hash because it may contain floating point numbers, which are problematic from a Ord and Eq perspective. We’re okay with skirting around that for our purposes here, so we implement our own hashable wrapper around the toml value.
Methods from Deref<Target = Value>§
pub fn get<I>(&self, index: I) -> Option<&Value>where
I: Index,
pub fn get<I>(&self, index: I) -> Option<&Value>where
I: Index,
Index into a TOML array or map. A string index can be used to access a value in a map, and a usize index can be used to access an element of an array.
Returns None
if the type of self
does not match the type of the
index, for example if the index is a string and self
is an array or a
number. Also returns None
if the given key does not exist in the map
or the given index is not within the bounds of the array.
pub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Extracts the integer value if it is an integer.
pub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Tests whether this value is an integer.
pub fn as_datetime(&self) -> Option<&Datetime>
pub fn as_datetime(&self) -> Option<&Datetime>
Extracts the datetime value if it is a datetime.
Note that a parsed TOML value will only contain ISO 8601 dates. An example date is:
1979-05-27T07:32:00Z
pub fn is_datetime(&self) -> bool
pub fn is_datetime(&self) -> bool
Tests whether this value is a datetime.
Trait Implementations§
source§impl Clone for HashableTomlValue
impl Clone for HashableTomlValue
source§fn clone(&self) -> HashableTomlValue
fn clone(&self) -> HashableTomlValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for HashableTomlValue
impl Debug for HashableTomlValue
source§impl Deref for HashableTomlValue
impl Deref for HashableTomlValue
source§impl<'de> Deserialize<'de> for HashableTomlValue
impl<'de> Deserialize<'de> for HashableTomlValue
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>,
source§impl From<HashableTomlValue> for Value
impl From<HashableTomlValue> for Value
source§fn from(value: HashableTomlValue) -> Value
fn from(value: HashableTomlValue) -> Value
source§impl From<Value> for HashableTomlValue
impl From<Value> for HashableTomlValue
source§impl Hash for HashableTomlValue
impl Hash for HashableTomlValue
Auto Trait Implementations§
impl Freeze for HashableTomlValue
impl RefUnwindSafe for HashableTomlValue
impl Send for HashableTomlValue
impl Sync for HashableTomlValue
impl Unpin for HashableTomlValue
impl UnwindSafe for HashableTomlValue
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more