+119
Cargo.lock
+119
Cargo.lock
···
105
105
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
106
106
107
107
[[package]]
108
+
name = "bumpalo"
109
+
version = "3.19.0"
110
+
source = "registry+https://github.com/rust-lang/crates.io-index"
111
+
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
112
+
113
+
[[package]]
108
114
name = "bytes"
109
115
version = "1.10.1"
110
116
source = "registry+https://github.com/rust-lang/crates.io-index"
···
271
277
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
272
278
273
279
[[package]]
280
+
name = "js-sys"
281
+
version = "0.3.78"
282
+
source = "registry+https://github.com/rust-lang/crates.io-index"
283
+
checksum = "0c0b063578492ceec17683ef2f8c5e89121fbd0b172cbc280635ab7567db2738"
284
+
dependencies = [
285
+
"once_cell",
286
+
"wasm-bindgen",
287
+
]
288
+
289
+
[[package]]
274
290
name = "libc"
275
291
version = "0.2.175"
276
292
source = "registry+https://github.com/rust-lang/crates.io-index"
277
293
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
294
+
295
+
[[package]]
296
+
name = "listenfd"
297
+
version = "1.0.2"
298
+
source = "registry+https://github.com/rust-lang/crates.io-index"
299
+
checksum = "b87bc54a4629b4294d0b3ef041b64c40c611097a677d9dc07b2c67739fe39dba"
300
+
dependencies = [
301
+
"libc",
302
+
"uuid",
303
+
"winapi",
304
+
]
278
305
279
306
[[package]]
280
307
name = "lock_api"
···
532
559
version = "0.1.0"
533
560
dependencies = [
534
561
"axum",
562
+
"listenfd",
535
563
"maud",
536
564
"tokio",
537
565
]
···
670
698
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
671
699
672
700
[[package]]
701
+
name = "uuid"
702
+
version = "1.18.1"
703
+
source = "registry+https://github.com/rust-lang/crates.io-index"
704
+
checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2"
705
+
dependencies = [
706
+
"js-sys",
707
+
"wasm-bindgen",
708
+
]
709
+
710
+
[[package]]
673
711
name = "version_check"
674
712
version = "0.9.5"
675
713
source = "registry+https://github.com/rust-lang/crates.io-index"
···
680
718
version = "0.11.1+wasi-snapshot-preview1"
681
719
source = "registry+https://github.com/rust-lang/crates.io-index"
682
720
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
721
+
722
+
[[package]]
723
+
name = "wasm-bindgen"
724
+
version = "0.2.101"
725
+
source = "registry+https://github.com/rust-lang/crates.io-index"
726
+
checksum = "7e14915cadd45b529bb8d1f343c4ed0ac1de926144b746e2710f9cd05df6603b"
727
+
dependencies = [
728
+
"cfg-if",
729
+
"once_cell",
730
+
"rustversion",
731
+
"wasm-bindgen-macro",
732
+
"wasm-bindgen-shared",
733
+
]
734
+
735
+
[[package]]
736
+
name = "wasm-bindgen-backend"
737
+
version = "0.2.101"
738
+
source = "registry+https://github.com/rust-lang/crates.io-index"
739
+
checksum = "e28d1ba982ca7923fd01448d5c30c6864d0a14109560296a162f80f305fb93bb"
740
+
dependencies = [
741
+
"bumpalo",
742
+
"log",
743
+
"proc-macro2",
744
+
"quote",
745
+
"syn",
746
+
"wasm-bindgen-shared",
747
+
]
748
+
749
+
[[package]]
750
+
name = "wasm-bindgen-macro"
751
+
version = "0.2.101"
752
+
source = "registry+https://github.com/rust-lang/crates.io-index"
753
+
checksum = "7c3d463ae3eff775b0c45df9da45d68837702ac35af998361e2c84e7c5ec1b0d"
754
+
dependencies = [
755
+
"quote",
756
+
"wasm-bindgen-macro-support",
757
+
]
758
+
759
+
[[package]]
760
+
name = "wasm-bindgen-macro-support"
761
+
version = "0.2.101"
762
+
source = "registry+https://github.com/rust-lang/crates.io-index"
763
+
checksum = "7bb4ce89b08211f923caf51d527662b75bdc9c9c7aab40f86dcb9fb85ac552aa"
764
+
dependencies = [
765
+
"proc-macro2",
766
+
"quote",
767
+
"syn",
768
+
"wasm-bindgen-backend",
769
+
"wasm-bindgen-shared",
770
+
]
771
+
772
+
[[package]]
773
+
name = "wasm-bindgen-shared"
774
+
version = "0.2.101"
775
+
source = "registry+https://github.com/rust-lang/crates.io-index"
776
+
checksum = "f143854a3b13752c6950862c906306adb27c7e839f7414cec8fea35beab624c1"
777
+
dependencies = [
778
+
"unicode-ident",
779
+
]
780
+
781
+
[[package]]
782
+
name = "winapi"
783
+
version = "0.3.9"
784
+
source = "registry+https://github.com/rust-lang/crates.io-index"
785
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
786
+
dependencies = [
787
+
"winapi-i686-pc-windows-gnu",
788
+
"winapi-x86_64-pc-windows-gnu",
789
+
]
790
+
791
+
[[package]]
792
+
name = "winapi-i686-pc-windows-gnu"
793
+
version = "0.4.0"
794
+
source = "registry+https://github.com/rust-lang/crates.io-index"
795
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
796
+
797
+
[[package]]
798
+
name = "winapi-x86_64-pc-windows-gnu"
799
+
version = "0.4.0"
800
+
source = "registry+https://github.com/rust-lang/crates.io-index"
801
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
683
802
684
803
[[package]]
685
804
name = "windows-sys"
+1
Cargo.toml
+1
Cargo.toml
+34
-11
src/main.rs
+34
-11
src/main.rs
···
1
1
use axum::{Router, routing::get};
2
-
use maud::{DOCTYPE, PreEscaped, html};
2
+
use listenfd::ListenFd;
3
+
use maud::{DOCTYPE, Markup, html};
3
4
use tokio::net::TcpListener;
4
5
5
6
#[tokio::main]
6
7
async fn main() {
7
-
let app = Router::new().route("/", get(hello_world));
8
+
let app = Router::new().route("/", get(index));
9
+
10
+
let mut listenfd = ListenFd::from_env();
11
+
12
+
let listener = match listenfd.take_tcp_listener(0).unwrap() {
13
+
// if we are given a tcp listener on listen fd 0, we use that one
14
+
Some(listener) => {
15
+
listener.set_nonblocking(true).unwrap();
16
+
TcpListener::from_std(listener).unwrap()
17
+
}
18
+
// otherwise fall back to local listening
19
+
None => TcpListener::bind("127.0.0.1:3000").await.unwrap(),
20
+
};
21
+
22
+
axum::serve(listener, app).await.unwrap()
23
+
}
8
24
9
-
let listener = TcpListener::bind("0.0.0.0:6969").await.unwrap();
10
-
axum::serve(listener, app).await.unwrap();
25
+
async fn index() -> Markup {
26
+
page(
27
+
"ShitSky",
28
+
html! {
29
+
p { "Hello from shitsky" }
30
+
},
31
+
)
11
32
}
12
33
13
-
async fn hello_world() -> PreEscaped<String> {
34
+
fn page(title: &str, body: Markup) -> Markup {
14
35
html! {
15
36
(DOCTYPE)
16
-
head {
17
-
meta lang="your mom";
18
-
title { "ShitSky" }
19
-
}
20
-
body {
21
-
p { "Hello from shitsky" }
37
+
html {
38
+
head {
39
+
meta lang="en";
40
+
title { (title) }
41
+
}
42
+
body {
43
+
(body)
44
+
}
22
45
}
23
46
}
24
47
}