summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2022-04-22 07:35:06 +0200
committerMatthias Beyer <mail@beyermatthias.de>2022-06-19 18:00:24 +0200
commitedc96c9e278afb4ec58309314022907612fa9292 (patch)
tree00df40310af9430c9220ccc382815136a7b1e6f5
parenta6414bb79199cdc5b5da86c21e732255e11fc053 (diff)
Add Value::origin()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/value.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/value.rs b/src/value.rs
index c3dad10..1727e4c 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -210,6 +210,11 @@ impl Value {
}
}
+ /// Get the description of the original location of the value.
+ pub fn origin(&self) -> Option<&str> {
+ self.origin.as_ref().map(AsRef::as_ref)
+ }
+
/// Attempt to deserialize this value into the requested type.
pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> {
T::deserialize(self)