pub struct JsonLocated<T, F> {
pub value: T,
pub location: JsonBacktraceBuf<F>,
}Expand description
A value paired with a source location.
Fields§
§value: TThe located value.
location: JsonBacktraceBuf<F>Backtrace describing where value was found.
Implementations§
Source§impl<T, F> JsonLocated<T, F>
impl<T, F> JsonLocated<T, F>
Sourcepub fn new(value: T, location: JsonBacktraceBuf<F>) -> Self
pub fn new(value: T, location: JsonBacktraceBuf<F>) -> Self
Pairs value with its location.
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> JsonLocated<U, F>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> JsonLocated<U, F>
Maps the located value, keeping its location unchanged.
Sourcepub fn cast<U>(self) -> JsonLocated<U, F>where
T: Into<U>,
pub fn cast<U>(self) -> JsonLocated<U, F>where
T: Into<U>,
Converts the located value into another type, keeping its location unchanged.
Trait Implementations§
Source§impl<T: Display, F> Display for JsonLocated<T, F>
impl<T: Display, F> Display for JsonLocated<T, F>
impl<T: Eq, F: Eq> Eq for JsonLocated<T, F>
Source§impl<T: 'static + Error, F: Debug> Error for JsonLocated<T, F>
impl<T: 'static + Error, F: Debug> Error for JsonLocated<T, F>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl<T: Ord, F: Ord> Ord for JsonLocated<T, F>
impl<T: Ord, F: Ord> Ord for JsonLocated<T, F>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<T: PartialOrd, F: PartialOrd> PartialOrd for JsonLocated<T, F>
impl<T: PartialOrd, F: PartialOrd> PartialOrd for JsonLocated<T, F>
impl<T: PartialEq, F: PartialEq> StructuralPartialEq for JsonLocated<T, F>
Auto Trait Implementations§
impl<T, F> Freeze for JsonLocated<T, F>
impl<T, F> RefUnwindSafe for JsonLocated<T, F>
impl<T, F> Send for JsonLocated<T, F>
impl<T, F> Sync for JsonLocated<T, F>
impl<T, F> Unpin for JsonLocated<T, F>
impl<T, F> UnsafeUnpin for JsonLocated<T, F>
impl<T, F> UnwindSafe for JsonLocated<T, F>
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
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
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
Compare self to
key and return true if they are equal.Source§impl<T> JsonAt for T
impl<T> JsonAt for T
Source§fn json_at<F>(
self,
location: impl Into<Vec<JsonBacktraceFrame<F>>>,
) -> JsonLocated<T, F>
fn json_at<F>( self, location: impl Into<Vec<JsonBacktraceFrame<F>>>, ) -> JsonLocated<T, F>
Pairs
self with location.