forked from wolf4ood/gremlin-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented map get & try_get backwards compatability logic to not br…
…eak derive macros
- Loading branch information
1 parent
2d2b13a
commit 081ad4e
Showing
5 changed files
with
79 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
use std::convert::TryFrom; | ||
|
||
#[derive(Debug, PartialEq, Clone, Eq, Hash)] | ||
pub enum T { | ||
Id, | ||
Key, | ||
Label, | ||
Value, | ||
} | ||
|
||
impl TryFrom<&str> for T { | ||
type Error = String; | ||
|
||
fn try_from(value: &str) -> Result<Self, Self::Error> { | ||
match value { | ||
"id" => Ok(T::Id), | ||
"key" => Ok(T::Key), | ||
"label" => Ok(T::Label), | ||
"value" => Ok(T::Value), | ||
other => Err(format!("Unknown T literal {other:?}")), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters