rust-embed v8.13.0
git clone https://git.pyrossh.dev/rust-embed
rust macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
63f2283
— pyros2097
2018-03-02T13:09:49+05:30
add lib export
Generated files not shown: Cargo.lock
- Cargo.toml +8 -1
- examples/hyper.rs +0 -60
Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "rust-embed"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
description = "Rust Marco which loads files into the rust binary at compile time during release and loads the file from the fs during dev"
|
|
5
5
|
readme = "readme.md"
|
|
6
6
|
documentation = "https://docs.rs/rust-embed"
|
|
@@ -10,6 +10,13 @@ keywords = ["http", "rocket", "static", "web", "server"]
|
|
|
10
10
|
categories = ["web-programming::http-server"]
|
|
11
11
|
authors = ["pyros2097 <[email protected]>"]
|
|
12
12
|
|
|
13
|
+
[lib]
|
|
14
|
+
name = "rust-embed"
|
|
15
|
+
plugin = true
|
|
16
|
+
|
|
13
17
|
[dependencies]
|
|
14
18
|
log = "0.4"
|
|
15
19
|
walkdir = "2.1.4"
|
|
20
|
+
|
|
21
|
+
[dev-dependencies]
|
|
22
|
+
actix-web = "0.3.3"
|
examples/hyper.rs
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// extern crate futures;
|
|
2
|
-
// extern crate hyper;
|
|
3
|
-
|
|
4
|
-
// use futures::future::Future;
|
|
5
|
-
|
|
6
|
-
// use hyper::header::ContentLength;
|
|
7
|
-
// use hyper::server::{Http, Request, Response, Service};
|
|
8
|
-
|
|
9
|
-
// mod assets;
|
|
10
|
-
|
|
11
|
-
// struct HelloWorld;
|
|
12
|
-
|
|
13
|
-
// const PHRASE: &'static str = "Hello, World!";
|
|
14
|
-
|
|
15
|
-
// impl Service for HelloWorld {
|
|
16
|
-
// // boilerplate hooking up hyper's server types
|
|
17
|
-
// type Request = Request;
|
|
18
|
-
// type Response = Response;
|
|
19
|
-
// type Error = hyper::Error;
|
|
20
|
-
// // The future representing the eventual Response your call will
|
|
21
|
-
// // resolve to. This can change to whatever Future you need.
|
|
22
|
-
// type Future = Box<Future<Item = Self::Response, Error = Self::Error>>;
|
|
23
|
-
|
|
24
|
-
// fn call(&self, _req: Request) -> Self::Future {
|
|
25
|
-
// // We're currently ignoring the Request
|
|
26
|
-
// // And returning an 'ok' Future, which means it's ready
|
|
27
|
-
// // immediately, and build a Response with the 'PHRASE' body.
|
|
28
|
-
// Box::new(futures::future::ok(
|
|
29
|
-
// Response::new()
|
|
30
|
-
// .with_header(ContentLength(PHRASE.len() as u64))
|
|
31
|
-
// .with_body(PHRASE),
|
|
32
|
-
// ))
|
|
33
|
-
// }
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// // fn handle_index(req: Request, res: Response) {
|
|
37
|
-
// // match req.uri {
|
|
38
|
-
// // AbsolutePath(ref path) => {
|
|
39
|
-
// // println!("GET {:?}", &path);
|
|
40
|
-
// // if &path[..] == "/" {
|
|
41
|
-
// // res.send(&assets::examples_public_index_html).unwrap();
|
|
42
|
-
// // } else {
|
|
43
|
-
// // res.send(assets::get(&path[1..path.len()]).unwrap()).unwrap();
|
|
44
|
-
// // }
|
|
45
|
-
// // },
|
|
46
|
-
// // _ => {
|
|
47
|
-
// // return;
|
|
48
|
-
// // }
|
|
49
|
-
// // }
|
|
50
|
-
// // }
|
|
51
|
-
|
|
52
|
-
// fn main() {
|
|
53
|
-
// println!("Server running on 127.0.0.1:3000");
|
|
54
|
-
// let addr = "127.0.0.1:3000".parse().unwrap();
|
|
55
|
-
// let server = Http::new().bind(&addr, || Ok(HelloWorld)).unwrap();
|
|
56
|
-
// server.run().unwrap();
|
|
57
|
-
// }
|
|
58
|
-
|
|
59
|
-
fn main() {
|
|
60
|
-
}
|