aboutsummaryrefslogtreecommitdiffstats
path: root/src/actix.rs
blob: e9201605cea5c071b580623840ce432f41cc0e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use std::fmt::Display;

use actix_web::Resource;
use actix_web::web::resource;

use crate::TypedUrl;

pub trait Endpoint : TypedUrl {
    fn endpoint(route : Self::Route) -> Resource;
}

impl<U> Endpoint for U
where
    U : TypedUrl + Display
{
    fn endpoint(r : U::Route) -> Resource {
        resource(r.to_string())
    }
}