1
0
Fork 0
forked from alemi/upub

fix: macro allows zero flat, removed invalid type

This commit is contained in:
əlemi 2024-03-19 22:47:52 +01:00
parent a4374c4ff0
commit 863ea0408d
Signed by: alemi
GPG key ID: A4895B84D311642C
13 changed files with 25 additions and 26 deletions

View file

@ -3,8 +3,8 @@ use crate::strenum;
strenum! {
pub enum LinkType {
Link,
Mention
}
Mention;
};
}
pub trait Link : super::Base {

View file

@ -13,11 +13,10 @@ use crate::strenum;
strenum! {
pub enum BaseType {
Invalid
;
Object(ObjectType),
Link(LinkType)
}
};
}
pub trait Base {

View file

@ -3,8 +3,8 @@ use crate::strenum;
strenum! {
pub enum AcceptType {
Accept,
TentativeAccept
}
TentativeAccept;
};
}
pub trait Accept : super::Activity {

View file

@ -3,8 +3,8 @@ use crate::strenum;
strenum! {
pub enum IgnoreType {
Ignore,
Block
}
Block;
};
}
pub trait Ignore : super::Activity {

View file

@ -5,8 +5,8 @@ strenum! {
IntransitiveActivity,
Arrive,
Question,
Travel
}
Travel;
};
}
pub trait IntransitiveActivity : super::Activity {

View file

@ -36,14 +36,14 @@ strenum! {
Remove,
Undo,
Update,
View
View;
IntransitiveActivity(IntransitiveActivityType),
Accept(AcceptType),
Ignore(IgnoreType),
Offer(OfferType),
Reject(RejectType)
}
};
}
pub trait Activity : super::Object {

View file

@ -3,8 +3,8 @@ use crate::strenum;
strenum! {
pub enum OfferType {
Offer,
Invite
}
Invite;
};
}
pub trait Offer : super::Activity {

View file

@ -3,8 +3,8 @@ use crate::strenum;
strenum! {
pub enum RejectType {
Reject,
TentativeReject
}
TentativeReject;
};
}
pub trait Reject : super::Activity {

View file

@ -8,8 +8,8 @@ strenum! {
Group,
Organization,
Person,
Object
}
Object;
};
}
pub trait Profile : super::Object {

View file

@ -9,8 +9,8 @@ strenum! {
Collection,
CollectionPage,
OrderedCollection,
OrderedCollectionPage
}
OrderedCollectionPage;
};
}
pub trait Collection : super::Object {

View file

@ -6,8 +6,8 @@ strenum! {
Audio,
Image,
Page,
Video
}
Video;
};
}
pub trait Document : super::Object {

View file

@ -29,13 +29,13 @@ strenum! {
Place,
Profile,
Relationship,
Tombstone
Tombstone;
Activity(ActivityType),
Actor(ActorType),
Collection(CollectionType),
Document(DocumentType)
}
};
}
pub trait Object : super::Base {

View file

@ -16,7 +16,7 @@ impl From<TypeValueError> for sea_orm::TryGetError {
#[macro_export]
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)]
pub enum $enum_name {