Skip to content

Commit

Permalink
Buffer Logging
Browse files Browse the repository at this point in the history
This demo file was originally from a demo I made back on July 30. I figured out how to get a sort of 'npm run dev' kind of thing working, I really like it! This kind of quick-feedback programming is how I get things done fast, as I can easily see when things go right, or wrong.

https://doc.rust-lang.org/rust-by-example/custom_types/structs.html
https://doc.rust-lang.org/book/ch16-01-threads.html
https://www.reddit.com/r/rust/comments/9twt89/show_rrust_cargocmd_like_npm_scripts_but_for_cargo/ (I was curious if you could do something like `cargo run dev` for this kind of hot reload script, but it didn't seem to work from what I tried. It is possible it sounds like, but I don't think I'm implementing it right. Going to use a Bash script for the meantime. I want it to work cross-platform though, so you can use this on Windows too and not have to do anything special for that. I know I could make a Batch file, but I'd rather use simple tooling with Cargo than roll my own thing for that. That's the same case with npm as well, to use the tools that are available to you! :D)
https://doc.rust-lang.org/cargo/reference/config.html#alias
https://pseitz.github.io/toml-to-json-online-converter/ (Neat concept, finding the similarities between TOML, JSON, and SNBT/NBT)
rust-lang/cargo#9061
rust-lang/cargo#8486 (comment) (Is my alias not working because of how I defined it in the config?)
  • Loading branch information
Offroaders123 committed Dec 18, 2023
1 parent bc00148 commit 7dcfb13
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cargo watch -c -q -x "run -q"
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
// cargo watch -c -q -x "run -q"

use std::fs::read;

fn main() {
println!("Hello, world!");
let file: &str = "../NBTify/test/nbt/hello_world.nbt";
println!("{}",file);

let data: Vec<u8> = read(file).unwrap();
println!("{:?}",&data);
}

// https://kerkour.com/rust-functional-programming
// https://dev.to/jorgecastro/hot-reload-in-rust-with-cargo-watch-5bon
// https://doc.rust-lang.org/cargo/commands/cargo-run.html
// https://stackoverflow.com/questions/31192956/whats-the-de-facto-way-of-reading-and-writing-files-in-rust-1-x
// https://stackoverflow.com/questions/28123923/how-do-i-print-a-vector-of-u8-as-a-string
// https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/std/path/struct.Path.html

0 comments on commit 7dcfb13

Please sign in to comment.