Merge flabk & flabk-derive repos

This commit is contained in:
emilis 2022-12-16 14:35:11 +00:00
parent 62c4946dfb
commit de12258368
34 changed files with 329 additions and 263 deletions

476
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,7 @@
[package] [workspace]
name = "flabk"
version = "0.0.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html members = [
"flabk",
"flabk-derive",
]
[dependencies]
anyhow = "1.0.64"
argon2 = "0.4.1"
async-trait = "0.1.58"
axum = "0.5.17"
base-62 = "0.1.1"
handlebars = "4.3.3"
jsonwebtoken = "8.1.1"
mime_guess = "2.0.4"
rand = "0.8.5"
rand_core = { version = "0.6.3", features = ["std"] }
reqwest = { version = "0.11.12", features = [
"__tls",
"default-tls",
"hyper-tls",
"native-tls-crate",
"tokio-native-tls",
"serde_json",
"json",
] }
rust-embed = "6.4.0"
serde = { version = "1.0.144", features = ["derive", "std", "serde_derive"] }
serde_json = "1.0.85"
tokio = { version = "1", features = ["full"] }
tokio-postgres = { version = "0.7.7", features = ["with-serde_json-1"] }
tower-cookies = "0.7.0"
flabk-derive = { git = "https://sectorinf.com/emilis/flabk-derive" }

15
flabk-derive/Cargo.toml Normal file
View File

@ -0,0 +1,15 @@
[package]
name = "flabk-derive"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["full"] }
[lib]
proc-macro = true

20
flabk-derive/src/lib.rs Normal file
View File

@ -0,0 +1,20 @@
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, DeriveInput};
#[proc_macro_derive(IRI)]
pub fn derive_iri(input: TokenStream) -> TokenStream {
let DeriveInput { ident, .. } = parse_macro_input!(input);
quote! {
impl std::str::FromStr for #ident {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut ident = #ident::default();
ident.id = s.into();
Ok(ident)
}
}
}
.into()
}

34
flabk/Cargo.toml Normal file
View File

@ -0,0 +1,34 @@
[package]
name = "flabk"
version = "0.0.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.64"
argon2 = "0.4.1"
async-trait = "0.1.58"
axum = "0.5.17"
base-62 = "0.1.1"
handlebars = "4.3.3"
jsonwebtoken = "8.1.1"
mime_guess = "2.0.4"
rand = "0.8.5"
rand_core = { version = "0.6.3", features = ["std"] }
reqwest = { version = "0.11.12", features = [
"__tls",
"default-tls",
"hyper-tls",
"native-tls-crate",
"tokio-native-tls",
"serde_json",
"json",
] }
rust-embed = "6.4.0"
serde = { version = "1.0.144", features = ["derive", "std", "serde_derive"] }
serde_json = "1.0.85"
tokio = { version = "1", features = ["full"] }
tokio-postgres = { version = "0.7.7", features = ["with-serde_json-1"] }
tower-cookies = "0.7.0"
flabk-derive = { path = "../flabk-derive" }

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -89,7 +89,13 @@ pub struct ObjectLD {
pub to_uris: Vec<String>, pub to_uris: Vec<String>,
} }
pub enum ActorType {} pub enum ActorType {
Application,
Group,
Organization,
Person,
Service,
}
#[derive(Debug, Clone, Deserialize, IRI, Default)] #[derive(Debug, Clone, Deserialize, IRI, Default)]
pub struct Actor { pub struct Actor {

View File

@ -1,4 +1,4 @@
use std::{convert::Infallible, fmt, marker::PhantomData, str::FromStr}; use std::{fmt, marker::PhantomData, str::FromStr};
use serde::{ use serde::{
de::{self, MapAccess, Visitor}, de::{self, MapAccess, Visitor},