Skip to content

Commit 2691039

Browse files
committed
revised to use workspace structure to avoid impacting build times for blog generation.
(trying to make change history here clearer by renaming `main.rs`.)
1 parent 7e98f22 commit 2691039

File tree

5 files changed

+28
-7
lines changed

5 files changed

+28
-7
lines changed

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ name = "blog"
33
version = "0.1.0"
44
authors = ["The Rust Project Developers"]
55
edition = "2021"
6-
default-run = "blog"
6+
7+
[[bin]]
8+
name = "blog"
9+
path = "src/blog.rs"
710

811
[dependencies]
912
handlebars = { version = "3", features = ["dir_source"] }
@@ -17,5 +20,6 @@ fs_extra = "1.2"
1720
regex = "1.3"
1821
sass-rs = "0.2"
1922
chrono = "0.4"
20-
warpy = "0.2.1"
21-
tokio = "1.0"
23+
24+
[workspace]
25+
members = ["serve"]

serve/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "serve"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
blog = { path = ".." }
10+
warpy = "0.2.1"
11+
tokio = "1.0"
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use std::error::Error;
22

3-
#[path="../main.rs"] mod main;
4-
53
#[tokio::main]
64
async fn main() -> Result<(), Box<dyn Error>> {
7-
main::main()?;
5+
blog::main()?;
86

97
let footer = format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
108

11-
warpy::server::run(format!("{}/site", env!("CARGO_MANIFEST_DIR")), [0, 0, 0, 0], footer, Some(8000), false).await?;
9+
warpy::server::run(format!("{}/../site", env!("CARGO_MANIFEST_DIR")), [0, 0, 0, 0], footer, Some(8000), false).await?;
1210
Ok(())
1311
}

src/blog.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use std::error::Error;
2+
3+
#[path = "lib.rs"]
4+
mod lib;
5+
6+
pub fn main() -> Result<(), Box<dyn Error>> {
7+
lib::main()
8+
}

src/main.rs renamed to src/lib.rs

File renamed without changes.

0 commit comments

Comments
 (0)