forked from alemi/upub
fix: macro allows zero flat, removed invalid type
This commit is contained in:
parent
a4374c4ff0
commit
863ea0408d
13 changed files with 25 additions and 26 deletions
|
@ -3,8 +3,8 @@ use crate::strenum;
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum LinkType {
|
pub enum LinkType {
|
||||||
Link,
|
Link,
|
||||||
Mention
|
Mention;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Link : super::Base {
|
pub trait Link : super::Base {
|
||||||
|
|
|
@ -13,11 +13,10 @@ use crate::strenum;
|
||||||
|
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum BaseType {
|
pub enum BaseType {
|
||||||
Invalid
|
;
|
||||||
|
|
||||||
Object(ObjectType),
|
Object(ObjectType),
|
||||||
Link(LinkType)
|
Link(LinkType)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Base {
|
pub trait Base {
|
||||||
|
|
|
@ -3,8 +3,8 @@ use crate::strenum;
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum AcceptType {
|
pub enum AcceptType {
|
||||||
Accept,
|
Accept,
|
||||||
TentativeAccept
|
TentativeAccept;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Accept : super::Activity {
|
pub trait Accept : super::Activity {
|
||||||
|
|
|
@ -3,8 +3,8 @@ use crate::strenum;
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum IgnoreType {
|
pub enum IgnoreType {
|
||||||
Ignore,
|
Ignore,
|
||||||
Block
|
Block;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Ignore : super::Activity {
|
pub trait Ignore : super::Activity {
|
||||||
|
|
|
@ -5,8 +5,8 @@ strenum! {
|
||||||
IntransitiveActivity,
|
IntransitiveActivity,
|
||||||
Arrive,
|
Arrive,
|
||||||
Question,
|
Question,
|
||||||
Travel
|
Travel;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait IntransitiveActivity : super::Activity {
|
pub trait IntransitiveActivity : super::Activity {
|
||||||
|
|
|
@ -36,14 +36,14 @@ strenum! {
|
||||||
Remove,
|
Remove,
|
||||||
Undo,
|
Undo,
|
||||||
Update,
|
Update,
|
||||||
View
|
View;
|
||||||
|
|
||||||
IntransitiveActivity(IntransitiveActivityType),
|
IntransitiveActivity(IntransitiveActivityType),
|
||||||
Accept(AcceptType),
|
Accept(AcceptType),
|
||||||
Ignore(IgnoreType),
|
Ignore(IgnoreType),
|
||||||
Offer(OfferType),
|
Offer(OfferType),
|
||||||
Reject(RejectType)
|
Reject(RejectType)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Activity : super::Object {
|
pub trait Activity : super::Object {
|
||||||
|
|
|
@ -3,8 +3,8 @@ use crate::strenum;
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum OfferType {
|
pub enum OfferType {
|
||||||
Offer,
|
Offer,
|
||||||
Invite
|
Invite;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Offer : super::Activity {
|
pub trait Offer : super::Activity {
|
||||||
|
|
|
@ -3,8 +3,8 @@ use crate::strenum;
|
||||||
strenum! {
|
strenum! {
|
||||||
pub enum RejectType {
|
pub enum RejectType {
|
||||||
Reject,
|
Reject,
|
||||||
TentativeReject
|
TentativeReject;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Reject : super::Activity {
|
pub trait Reject : super::Activity {
|
||||||
|
|
|
@ -8,8 +8,8 @@ strenum! {
|
||||||
Group,
|
Group,
|
||||||
Organization,
|
Organization,
|
||||||
Person,
|
Person,
|
||||||
Object
|
Object;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Profile : super::Object {
|
pub trait Profile : super::Object {
|
||||||
|
|
|
@ -9,8 +9,8 @@ strenum! {
|
||||||
Collection,
|
Collection,
|
||||||
CollectionPage,
|
CollectionPage,
|
||||||
OrderedCollection,
|
OrderedCollection,
|
||||||
OrderedCollectionPage
|
OrderedCollectionPage;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Collection : super::Object {
|
pub trait Collection : super::Object {
|
||||||
|
|
|
@ -6,8 +6,8 @@ strenum! {
|
||||||
Audio,
|
Audio,
|
||||||
Image,
|
Image,
|
||||||
Page,
|
Page,
|
||||||
Video
|
Video;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Document : super::Object {
|
pub trait Document : super::Object {
|
||||||
|
|
|
@ -29,13 +29,13 @@ strenum! {
|
||||||
Place,
|
Place,
|
||||||
Profile,
|
Profile,
|
||||||
Relationship,
|
Relationship,
|
||||||
Tombstone
|
Tombstone;
|
||||||
|
|
||||||
Activity(ActivityType),
|
Activity(ActivityType),
|
||||||
Actor(ActorType),
|
Actor(ActorType),
|
||||||
Collection(CollectionType),
|
Collection(CollectionType),
|
||||||
Document(DocumentType)
|
Document(DocumentType)
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Object : super::Base {
|
pub trait Object : super::Base {
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl From<TypeValueError> for sea_orm::TryGetError {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! strenum {
|
macro_rules! strenum {
|
||||||
( $(pub enum $enum_name:ident { $($flat:ident),+ $($deep:ident($inner:ident)),*})+ ) => {
|
( $(pub enum $enum_name:ident { $($flat:ident),* ; $($deep:ident($inner:ident)),* };)+ ) => {
|
||||||
$(
|
$(
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
||||||
pub enum $enum_name {
|
pub enum $enum_name {
|
||||||
|
|
Loading…
Reference in a new issue