Compare commits
1 commit
b5de7d55e9
...
b8b7fe3220
Author | SHA1 | Date | |
---|---|---|---|
b8b7fe3220 |
2 changed files with 0 additions and 58 deletions
|
@ -8,7 +8,6 @@ mod forge_name;
|
|||
mod forge_type;
|
||||
pub mod git_dir;
|
||||
mod host_name;
|
||||
mod newtype;
|
||||
mod registered_webhook;
|
||||
mod repo_alias;
|
||||
mod repo_branches;
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
//
|
||||
#[macro_export]
|
||||
macro_rules! newtype {
|
||||
($name:ident is a $type:ty, without Display) => {
|
||||
#[derive(
|
||||
Clone,
|
||||
Default,
|
||||
Debug,
|
||||
derive_more::From,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
derive_more::AsRef,
|
||||
derive_more::Deref,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
)]
|
||||
pub struct $name($type);
|
||||
impl $name {
|
||||
pub fn new(value: impl Into<$type>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
pub fn unwrap(self) -> $type {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
};
|
||||
($name:ident is a $type:ty) => {
|
||||
#[derive(
|
||||
Clone,
|
||||
Default,
|
||||
Debug,
|
||||
derive_more::Display,
|
||||
derive_more::From,
|
||||
PartialEq,
|
||||
Eq,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Hash,
|
||||
derive_more::AsRef,
|
||||
derive_more::Deref,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
)]
|
||||
pub struct $name($type);
|
||||
impl $name {
|
||||
pub fn new(value: impl Into<$type>) -> Self {
|
||||
Self(value.into())
|
||||
}
|
||||
pub fn unwrap(self) -> $type {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue