diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..78cface 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,5 +1,10 @@ + + + + + diff --git a/src/traits.rs b/src/traits.rs index abd689f..f1115c5 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -6,3 +6,16 @@ pub trait FromObject: Sized { /// Performs the conversion. fn try_from(value: T) -> Result; } + +pub trait TryInto :Sized { + fn try_into(self) -> Result; +} + +impl TryInto for T + where + U: FromObject, +{ + fn try_into(self) -> Result { + U::try_from(self) + } +} \ No newline at end of file