Crates.io | uller |
lib.rs | uller |
version | 0.1.23 |
source | src |
created_at | 2024-08-01 17:15:50.80716 |
updated_at | 2024-08-01 19:42:37.989768 |
description | Generate/Donwload your links |
homepage | |
repository | https://github.com/TOwInOK/uller |
max_upload_size | |
id | 1322243 |
size | 13,998 |
This crate provides you with:
MakeLink
Url
from a structure.JsonDownload<T>
Url
using MakeLink
and converting it to a <T>
structure.BytesDownload
bytes
from a MakeLink
conversion.Note: Add url crate for your project.
MakeLink
in query style using a struct as inputuse 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.
<T>
using a struct that implements MakeLink
(Qller
) and JsonDownload
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()
}
Bytes
using a struct that implements MakeLink
(Qller
) and BytesDownload
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()
}