#api-bindings #api-wrapper #rest #rest-api #client #api

macro rrw_macro

A macro crate for rrw to easily build clients for REST-APIs

2 releases

0.1.1 Mar 14, 2022
0.1.0 Mar 10, 2022

#20 in #rest-api


Used in hafas-rest

GPL-3.0-or-later

6KB

RRW-Macro (Rust REST Wrapper)

A macro crate for rrw to easily build clients for REST-APIs.

Example

#[rest]
impl Bahn {
    async fn location(&self, location: &LocationQuery) -> Result<Vec<Location>, reqwest::Error> {
        RestRequest::<&LocationQuery, ()>::get("/locations").query(location)
    }
}

For more information, look at the rrw-crate.


lib.rs:

RRW-Macro (Rust REST Wrapper)

A crate bringing a easy-to-use macro for usage with the crate rrw to build REST-clients.

Example

#
#
#
#[rest]
impl Bahn {
    async fn location(
        &self, location: &LocationQuery
    ) -> Result<Vec<Location>, Error<StandardRestError>> {
        RestRequest::<&LocationQuery, ()>::get("/locations").query(location)
    }
}

Further examples can be found in the rrw crate.

Dependencies

~1.5MB
~36K SLoC