Crates.io | pretty_debug |
lib.rs | pretty_debug |
version | 0.1.4 |
source | src |
created_at | 2022-08-10 08:28:25.523632 |
updated_at | 2022-08-10 09:12:49.37924 |
description | Simple crate for module based formatted console prints |
homepage | |
repository | https://github.com/Kay-Conte/Debugger-rs |
max_upload_size | |
id | 642504 |
size | 5,551 |
Pretty Debug adds a Debugger
trait which simply allows you to print to the console with user defined module tags.
This crate is fine to use though I doubt will ever be needed due to severe lack of functionality but is intended as a test to publish to crates.io
Simply define an enum implementing the Debugger trait as following:
enum Debug {
Module,
}
impl Debugger for Debug {
fn display(&self) -> String {
match self {
Debug::Module => "[From Module]",
}
.to_string()
}
}
Note: the return of the display
function are used as a prefix.
Then call the debug method on the desired variant of your enum:
Debug::Module.debug("This was sent from the Module module")
You may refer to the provided example for additional ergonomics.
I expect this crate to only be in use by me, though feel free to make any requests through github with additional features or changes.
I may add some other smaller features in the future if desired for my projects, such as a suffix and default function definitions later.