[−][src]Struct json_spanned_value::spanned::Spanned
A value with start/end position information. Can wrap arbitrary Deserializeable JSON values, not just basic JSON types.
Implementations
impl<V> Spanned<V>
[src]
pub fn start(&self) -> usize
[src]
Get the starting byte offset (inclusive) of this value.
Likely 0
unless loaded through crate::from_*.
pub fn end(&self) -> usize
[src]
Get the ending byte offset (non-inclusive) of this value.
Likely 0
unless loaded through crate::from_*.
pub fn span(&self) -> (usize, usize)
[src]
Get the start .. end byte offset of this value as a (start, end) tuple.
Likely (0, 0)
unless loaded through crate::from_*.
pub fn range(&self) -> Range<usize>
[src]
Get the start .. end byte offset of this value as a start .. end Range.
Likely 0 .. 0
unless loaded through crate::from_*.
pub fn into_inner(self) -> V
[src]
Get the interior value of the spanned region as an owned value.
pub fn get_ref(&self) -> &V
[src]
Get the interior value of the spanned region as a reference.
pub fn get_mut(&mut self) -> &mut V
[src]
Get the interior value of the spanned region as a mutable/exclusive reference.
impl Spanned<Value>
[src]
Various conversion methods:
as_span_[type]()
returns borrowingOption
s of some sort.into_span_[type]()
returnsOk(type)
orErr(original)
.
See also on super::Value as provided by Deref
implementation:
is_[type]()
returns bools with obvious meanings.as_[type]()
for borrowingOption
s without span info.into_[type]()
forOk(type)
without span info, orErr(original)
.
pub fn as_span_null(&self) -> Option<Null>
[src]
Some(span + ()) if self is
null`
pub fn as_span_bool(&self) -> Option<Bool>
[src]
Some(span + inner)
if self is true
or false
pub fn as_span_number(&self) -> Option<Num<'_>>
[src]
Some(span + &inner)
if self is a number like 123
pub fn as_span_string(&self) -> Option<Str<'_>>
[src]
Some(span + &inner)
if self is a string like "asdf"
pub fn as_span_array(&self) -> Option<Span<'_>>
[src]
Some(span + &inner)
if self is an array like [1, 2, 3]
pub fn as_span_object(&self) -> Option<Obj<'_>>
[src]
Some(span + &inner)
if self is an object like {"a": 1, "b": 2}
pub fn into_span_null(self) -> Result<Null, Self>
[src]
Ok(span + ())
if self is null
, otherwise Err(self)
pub fn into_span_bool(self) -> Result<Bool, Self>
[src]
Ok(span + inner)
if self is true
or false
, otherwise Err(self)
pub fn into_span_number(self) -> Result<Number, Self>
[src]
Ok(span + inner)
if self is a number like 123
, otherwise Err(self)
pub fn into_span_string(self) -> Result<String, Self>
[src]
Ok(span + inner)
if self is a string like "asdf"
, otherwise Err(self)
pub fn into_span_array(self) -> Result<Array, Self>
[src]
Ok(span + inner)
if self is an array like [1, 2, 3]
, otherwise Err(self)
pub fn into_span_object(self) -> Result<Object, Self>
[src]
Ok(span + inner)
if self is an object like {"a": 1, "b": 2}
, otherwise Err(self)
Trait Implementations
impl<R, V: AsRef<R>> AsRef<R> for Spanned<V>
[src]
impl<V: Clone> Clone for Spanned<V>
[src]
impl<V: Debug> Debug for Spanned<V>
[src]
impl<V> Deref for Spanned<V>
[src]
impl<'de, V: Deserialize<'de>> Deserialize<'de> for Spanned<V>
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl<V: Display> Display for Spanned<V>
[src]
impl<V: Eq> Eq for Spanned<V>
[src]
impl<V> From<V> for Spanned<V>
[src]
impl<V: Hash> Hash for Spanned<V>
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, K: Hash + Ord + 'a, V: 'a> IntoIterator for &'a Spanned<Map<K, V>>
[src]
type Item = (&'a K, &'a V)
The type of the elements being iterated over.
type IntoIter = <&'a IndexMap<K, V> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, K: Hash + Ord + 'a, V: 'a> IntoIterator for &'a mut Spanned<Map<K, V>>
[src]
type Item = (&'a K, &'a mut V)
The type of the elements being iterated over.
type IntoIter = <&'a mut IndexMap<K, V> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<K: Hash + Ord, V> IntoIterator for Spanned<Map<K, V>>
[src]
type Item = (K, V)
The type of the elements being iterated over.
type IntoIter = <IndexMap<K, V> as IntoIterator>::IntoIter
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<V: Ord> Ord for Spanned<V>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<V: PartialEq> PartialEq<Spanned<V>> for Spanned<V>
[src]
impl<V: PartialOrd> PartialOrd<Spanned<V>> for Spanned<V>
[src]
Auto Trait Implementations
impl<V> RefUnwindSafe for Spanned<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> Send for Spanned<V> where
V: Send,
V: Send,
impl<V> Sync for Spanned<V> where
V: Sync,
V: Sync,
impl<V> Unpin for Spanned<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for Spanned<V> where
V: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,