aboutsummaryrefslogtreecommitdiff
path: root/src/ids.rs
diff options
context:
space:
mode:
authorGravatar Dmitry Gavrovsky <dmitrygavrovsky@gmail.com> 2021-12-11 20:23:11 +0200
committerGravatar GitHub <noreply@github.com> 2021-12-11 10:23:11 -0800
commitf48378ec16af1035af32ed16592099104a552d90 (patch)
tree5407e21cb7e99d379c5c6f5474def43ad7e99388 /src/ids.rs
parente28f581e1d91bbe40074c47a90b0bdf6528107c2 (diff)
downloadnotion-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.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ids.rs b/src/ids.rs
index 2ede5e0..beffd06 100644
--- a/src/ids.rs
+++ b/src/ids.rs
@@ -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()))
+ }
+ }
};
}