auric-runtime 0.1.2-rc.2

Runtime module for the `auric` MVC SPA framework
Documentation
use async_trait::async_trait;

#[async_trait]
#[allow(unused)]
pub trait Route<M> {
    // async fn model(&self, params: serde_json::Value) -> anyhow::Result<M>;
    fn name(&self) -> &'static str;
    // fn router(&self) -> Arc<Router>;
}

#[cfg(test)]
mod tests {
    use super::Route;
    use async_trait::async_trait;

    #[test]
    fn can_implement_route() {
        struct MyModel {
            #[allow(unused)]
            pub a: String,
            #[allow(unused)]
            pub b: String,
        }
        struct MyRoute {
            // router: Arc<Router>,
        }

        #[async_trait]
        impl Route<MyModel> for MyRoute {
            // async fn model(&self, _params: serde_json::Value) -> anyhow::Result<MyModel> {
            //     Ok(MyModel {
            //         a: "A".to_string(),
            //         b: "B".to_string(),
            //     })
            // }
            fn name(&self) -> &'static str {
                "my-route"
            }
            // fn router(&self) -> Arc<Router> {
            //     self.router.clone()
            // }
        }
    }
}