This crate provides you with:
MakeLink- An interface for generating a
Urlfrom a structure.
- An interface for generating a
JsonDownload<T>- An interface for fetching data from a generated
UrlusingMakeLinkand converting it to a<T>structure.
- An interface for fetching data from a generated
BytesDownload- An interface for downloading data as
bytesfrom aMakeLinkconversion.
- An interface for downloading data as
Note: Add url crate for your project.
Information below contains examples from the uller-macro crate.
use uller::prelude;
#[derive(Qller)]
#[url = "http://127.0.0.1:1234/"]
struct Test {
#[name = "f"] // rename to "f"
f111: String,
#[name = "v"] // rename to "v"
#[pos = 0] // move it to the first position
v222: String,
}This will convert to: http://127.0.0.1:1234/?v={value}&f={value}
Note: Positions start at 0, like an array.
use uller::prelude;
#[derive(Qller, Juller)]
#[output = "TestOut"]
#[url = "http://127.0.0.1:41112/"]
struct Test {
f: String,
v: String,
}
#[derive(Deserialize, Debug)]
struct TestOut {
field: String,
}
async fn convert(st: &Test) -> TestOut {
st.download().await.unwrap()
// or
st.download_verbose().await.unwrap()
}use uller::prelude;
#[derive(Qller, Buller)]
#[url = "http://127.0.0.1:41112/"]
struct Test {
f: String,
v: String,
}
async fn convert(st: &Test) -> bytes::Bytes {
st.download().await.unwrap()
// or
st.download_verbose().await.unwrap()
}