6 releases

0.1.23 Aug 1, 2024
0.1.22 Aug 1, 2024

#1661 in Asynchronous

Download history 21/week @ 2024-08-09 2/week @ 2024-08-16 4/week @ 2024-08-30 1/week @ 2024-09-06 5/week @ 2024-09-13 2/week @ 2024-09-20 4/week @ 2024-09-27 2/week @ 2024-10-04 6/week @ 2024-10-18 20/week @ 2024-10-25

64 downloads per month
Used in shuller

MIT license

8KB
52 lines

Uller

About

This crate provides you with:

  • MakeLink
    • An interface for generating a Url from a structure.
  • JsonDownload<T>
    • An interface for fetching data from a generated Url using MakeLink and converting it to a <T> structure.
  • BytesDownload
    • An interface for downloading data as bytes from a MakeLink conversion.

Note: Add url crate for your project.

Information below contains examples from the uller-macro crate.

Example (future - macro)

Qller (default)

Example

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.

Example (future - juller)

Juller (feature - juller)

Example

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()
}

Example (future - buller)

Buller (feature - buller)

Example

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()
}

Dependencies

~2–13MB
~152K SLoC