Browse Source

split into library plus binary

Getty Ritter 10 months ago
parent
commit
0faf56ed59
4 changed files with 13 additions and 8 deletions
  1. 7 1
      Cargo.toml
  2. 3 0
      src/lib.rs
  3. 3 7
      src/main.rs
  4. 0 0
      tools/from-png/opts.rs

+ 7 - 1
Cargo.toml

@@ -3,7 +3,9 @@ name = "thyme"
 version = "0.1.0"
 version = "0.1.0"
 edition = "2021"
 edition = "2021"
 
 
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+[lib]
+name = "thyme"
+path = "src/lib.rs"
 
 
 [dependencies]
 [dependencies]
 png = "*"
 png = "*"
@@ -13,3 +15,7 @@ pangocairo = "*"
 serde = { version = "*", features = ["derive"] }
 serde = { version = "*", features = ["derive"] }
 serde_yaml = "*"
 serde_yaml = "*"
 clap = { version = "*", features = ["derive"] }
 clap = { version = "*", features = ["derive"] }
+
+[[bin]]
+name = "thyme-from-png"
+path = "tools/from-png/main.rs"

+ 3 - 0
src/lib.rs

@@ -0,0 +1,3 @@
+pub mod data;
+pub mod draw;
+pub mod image;

+ 3 - 7
src/main.rs

@@ -1,13 +1,9 @@
-mod data;
-mod draw;
-mod image;
 mod opts;
 mod opts;
 
 
 use clap::Parser;
 use clap::Parser;
-
-use crate::data::{Config, Mapping};
-use crate::draw::Pattern;
-use crate::image::Image;
+use thyme::{data::{Config, Mapping},
+            draw::Pattern,
+            image::Image};
 use crate::opts::Options;
 use crate::opts::Options;
 
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
 fn main() -> Result<(), Box<dyn std::error::Error>> {

src/opts.rs → tools/from-png/opts.rs