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! { strenum! {
pub enum LinkType { pub enum LinkType {
Link, Link,
Mention Mention;
} };
} }
pub trait Link : super::Base { pub trait Link : super::Base {

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

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

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

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

View file

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

View file

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

View file

@ -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 {

View file

@ -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 {