diff options
author | 2021-12-11 20:23:11 +0200 | |
---|---|---|
committer | 2021-12-11 10:23:11 -0800 | |
commit | f48378ec16af1035af32ed16592099104a552d90 (patch) | |
tree | 5407e21cb7e99d379c5c6f5474def43ad7e99388 /src/ids.rs | |
parent | e28f581e1d91bbe40074c47a90b0bdf6528107c2 (diff) | |
download | notion-f48378ec16af1035af32ed16592099104a552d90.tar.gz notion-f48378ec16af1035af32ed16592099104a552d90.tar.zst notion-f48378ec16af1035af32ed16592099104a552d90.zip |
fix(example): Example wasn't compling + lib fixes (#19)
* get page + query database bugfixes
* fixed wrong error type
* clap integration fix
* comments cleaning
* source formatting using cargo format
Diffstat (limited to 'src/ids.rs')
-rw-r--r-- | src/ids.rs | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,9 +1,9 @@ use std::fmt::Display; +use std::fmt::Error; pub trait Identifier: Display { fn value(&self) -> &str; } - /// Meant to be a helpful trait allowing anything that can be /// identified by the type specified in `ById`. pub trait AsIdentifier<ById: Identifier> { @@ -45,6 +45,14 @@ macro_rules! identifer { self.0.fmt(f) } } + + impl std::str::FromStr for $name { + type Err = Error; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + Ok($name(s.to_string())) + } + } }; } |