diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2022-04-22 07:35:06 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2022-06-19 18:00:24 +0200 |
commit | edc96c9e278afb4ec58309314022907612fa9292 (patch) | |
tree | 00df40310af9430c9220ccc382815136a7b1e6f5 | |
parent | a6414bb79199cdc5b5da86c21e732255e11fc053 (diff) |
Add Value::origin()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/value.rs | 5 |
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) |