Slava Barinov 7 сар өмнө
commit
ede5fadc8b
3 өөрчлөгдсөн 42 нэмэгдсэн , 0 устгасан
  1. 8 0
      .cargo/config.toml
  2. 14 0
      Cargo.toml
  3. 20 0
      src/main.rs

+ 8 - 0
.cargo/config.toml

@@ -0,0 +1,8 @@
+[build]
+rustflags = ["-C", "target-feature=+crt-static"]
+target = ["x86_64-unknown-linux-musl"]
+
+[unstable]
+unstable-options = true
+build-std = ["std", "panic_abort"]
+build-std-features = ["optimize_for_size"]

+ 14 - 0
Cargo.toml

@@ -0,0 +1,14 @@
+[package]
+name = "strust"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+termio = "0.1"
+
+[profile.release]
+opt-level = "z"     # Optimize for size.
+lto = true          # Enable Link Time Optimization
+codegen-units = 1   # Reduce number of codegen units to increase optimizations.
+panic = "abort"     # Abort on panic
+strip = true        # Automatically strip symbols from the binary.

+ 20 - 0
src/main.rs

@@ -0,0 +1,20 @@
+use termio::{StyledText, Termio};
+
+fn main() {
+    let mut termio = Termio::new();
+
+    // Parse CSS-like syntax from a string
+    let css = r#"
+        @element "header" {
+            color: red;
+            background: black;
+            decoration: bold;
+            padding: 1;
+        }
+    "#;
+
+    termio.parse(css).unwrap();
+
+    // Style text using the parsed styles
+    println!("{}", "This is a header".style("header", &termio));
+}