-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparallel_compare.rs
More file actions
50 lines (42 loc) · 1.12 KB
/
parallel_compare.rs
File metadata and controls
50 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#![recursion_limit = "512"]
use hypershell::prelude::*;
use hypershell_examples::dsl::Compare;
use hypershell_examples::presets::HypershellComparePreset;
use hypershell_hash_components::dsl::{BytesToHex, Checksum};
use reqwest::Client;
use sha2::Sha256;
pub type GetChecksumOf<Url> = hypershell! {
StreamingHttpRequest<
GetMethod,
Url,
WithHeaders[ ],
>
| Checksum<Sha256>
| BytesToHex
};
pub type Program = hypershell! {
Compare<
GetChecksumOf<FieldArg<"url_a">>,
GetChecksumOf<FieldArg<"url_b">>,
>
};
#[cgp_inherit(HypershellComparePreset)]
#[derive(HasField)]
pub struct MyApp {
pub http_client: Client,
pub url_a: String,
pub url_b: String,
}
#[tokio::main]
async fn main() -> Result<(), Error> {
let app = MyApp {
http_client: Client::new(),
url_a: "https://nixos.org/manual/nixpkgs/unstable/".to_owned(),
url_b: "https://nixos.org/manual/nixpkgs/unstable".to_owned(),
};
let res = app
.handle(PhantomData::<Program>, (<Vec<u8>>::new(), <Vec<u8>>::new()))
.await?;
println!("equals: {res}");
Ok(())
}