summaryrefslogtreecommitdiffstats
path: root/src/value.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-03-14 09:26:51 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-14 09:48:59 +0100
commitc26a941541ccd7733f7533372da71f0a5be36ed5 (patch)
tree2ed0a5f2df07dd3dcdbf73af9394cdea5f9df57a /src/value.rs
parenta3f205dc628b59a32de813b3efefbaec4667d217 (diff)
Rename try_into/try_from
Because of the clash in names with the TryInto and TryFrom traits, we're renaming the functions here to try_serialize/try_deserialize. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/value.rs')
-rw-r--r--src/value.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/value.rs b/src/value.rs
index 177acf7..700279b 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -151,12 +151,12 @@ impl Value {
}
/// Attempt to deserialize this value into the requested type.
- pub fn try_into<'de, T: Deserialize<'de>>(self) -> Result<T> {
+ pub fn try_deserialize<'de, T: Deserialize<'de>>(self) -> Result<T> {
T::deserialize(self)
}
/// Returns `self` as a bool, if possible.
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_bool(self) -> Result<bool> {
match self.kind {
ValueKind::Boolean(value) => Ok(value),
@@ -197,7 +197,7 @@ impl Value {
}
/// Returns `self` into an i64, if possible.
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_int(self) -> Result<i64> {
match self.kind {
ValueKind::Integer(value) => Ok(value),
@@ -242,7 +242,7 @@ impl Value {
}
/// Returns `self` into a f64, if possible.
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_float(self) -> Result<f64> {
match self.kind {
ValueKind::Float(value) => Ok(value),
@@ -287,7 +287,7 @@ impl Value {
}
/// Returns `self` into a str, if possible.
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_str(self) -> Result<String> {
match self.kind {
ValueKind::String(value) => Ok(value),
@@ -316,7 +316,7 @@ impl Value {
}
/// Returns `self` into an array, if possible
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_array(self) -> Result<Vec<Value>> {
match self.kind {
ValueKind::Array(value) => Ok(value),
@@ -356,7 +356,7 @@ impl Value {
}
/// If the `Value` is a Table, returns the associated Map.
- // FIXME: Should this not be `try_into_*` ?
+ // FIXME: Should this not be `try_deserialize_*` ?
pub fn into_table(self) -> Result<HashMap<String, Value>> {
match self.kind {
ValueKind::Table(value) => Ok(value),