From 315ed1fecdd1d6b7ace03f4b212ef1dee948f333 Mon Sep 17 00:00:00 2001 From: kamack38 <64226248+kamack38@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:57:11 +0100 Subject: [PATCH] =?UTF-8?q?feat(lib):=20=F0=9F=8E=B8=20Create=20a=20librar?= =?UTF-8?q?y=20crate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BREAKING CHANGE: 🧨 RamMachine and other stuff cannot be accessed using crate:: in main (use ram_machine:: instead) --- Cargo.toml | 5 +++++ src/cli.rs | 2 +- src/lib.rs | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 0de0579..77e77cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,11 @@ repository = "https://github.com/kamack38/ram-machine" keywords = ["cli", "ram", "machine", "maszyna"] categories = ["command-line-utilities"] +[lib] +name = "ram_machine" +path = "src/lib.rs" +doc = true + [[bin]] name = "ram" path = "src/main.rs" diff --git a/src/cli.rs b/src/cli.rs index fcb9b77..9f6b4bf 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use std::{fs, io}; use thiserror::Error; -use crate::{ +use ram_machine::{ interpreter::{RamMachine, RamMachineError}, parser::ParserError, }; diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..b3bb678 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,6 @@ +pub mod interpreter; +pub mod parser; + +pub use parser::instruction; +pub use parser::operand; +pub use parser::ram_code;