~lthms/typed-urls

576febfee5bb0f8b24635e3f510a68e401832ec6 — Thomas Letan 11 months ago c6c6be8
Rename into typed-urls
4 files changed, 12 insertions(+), 12 deletions(-)

M Cargo.toml
M tests/simple.rs
R routes-derive/Cargo.toml => typed-urls-derive/Cargo.toml
R routes-derive/src/lib.rs => typed-urls-derive/src/lib.rs
M Cargo.toml => Cargo.toml +3 -3
@@ 1,12 1,12 @@
[workspace]
members = ['routes-derive']
members = ['typed-urls-derive']

[package]
name = "routes"
name = "typed-urls"
version = "0.1.0"
authors = ["Thomas Letan <lthms@soap.coffee>"]
edition = "2018"

[dependencies]
serde_json = "*"
routes-derive = { path = "routes-derive/" }
\ No newline at end of file
typed-urls-derive = { path = "typed-urls-derive/" }
\ No newline at end of file

M tests/simple.rs => tests/simple.rs +2 -2
@@ 1,7 1,7 @@
#[macro_use]
extern crate routes_derive;
extern crate typed_urls_derive;

#[derive(Routes)]
#[derive(TypedUrl)]
pub enum Url {
    #[routefmt = "/worlds"]
    Worlds,

R routes-derive/Cargo.toml => typed-urls-derive/Cargo.toml +1 -1
@@ 1,5 1,5 @@
[package]
name = "routes-derive"
name = "typed-urls-derive"
version = "0.1.0"
authors = ["Thomas Letan <lthms@soap.coffee>"]
edition = "2018"

R routes-derive/src/lib.rs => typed-urls-derive/src/lib.rs +6 -6
@@ 12,11 12,11 @@ use syn::{
    MetaNameValue, Type, Variant,
};

#[proc_macro_derive(Routes, attributes(routefmt))]
pub fn derive_routes_main(input : TokenStream) -> TokenStream {
#[proc_macro_derive(TypedUrl, attributes(routefmt))]
pub fn derive_typed_url_main(input : TokenStream) -> TokenStream {
    let ast : DeriveInput = parse_macro_input!(input as DeriveInput);

    let res = derive_routes_boilerplate(&ast);
    let res = derive_typed_url_boilerplate(&ast);

    res.into()
}


@@ 167,7 167,7 @@ fn derive_route_to_string(
    }
}

fn derive_routes_boilerplate(ast : &DeriveInput) -> Quote {
fn derive_typed_url_boilerplate(ast : &DeriveInput) -> Quote {
    let enum_name = &ast.ident;
    let enum_ast = get_enum_data(&ast);



@@ 192,7 192,7 @@ fn derive_routes_boilerplate(ast : &DeriveInput) -> Quote {

    quote! {
        use std::iter::Iterator;
        use routes::Routing;
        use typed_urls::Routing;

        #enum_to_string
        #route_enum


@@ 262,7 262,7 @@ fn derive_route_to_url(
            &self,
            args : &std::collections::HashMap<String, serde_json::Value>,
        ) -> Option<#name> {
            use routes::Arg;
            use typed_urls::Arg;
            match self {
                #(#match_bodies),*
            }