bus.rs: Make hex-dumping optional to cut deps
This commit is contained in:
parent
a40ee94499
commit
dbc96648f1
18
Cargo.toml
18
Cargo.toml
@ -3,6 +3,11 @@ name = "chirp"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
rhexdump = ["dep:rhexdump"]
|
||||||
|
serde = ["dep:serde"]
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 'z'
|
opt-level = 'z'
|
||||||
@ -17,11 +22,10 @@ overflow-checks = false
|
|||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gumdrop = "0.8.1"
|
gumdrop = "^0.8.1"
|
||||||
hex-wrapper = "1.3.2"
|
minifb = { version = "^0.24.0", features = ["wayland"] }
|
||||||
minifb = "0.24.0"
|
|
||||||
owo-colors = "^3"
|
owo-colors = "^3"
|
||||||
rand = "0.8.5"
|
rand = "^0.8.5"
|
||||||
rhexdump = "0.1.1"
|
rhexdump = {version = "^0.1.1", optional = true }
|
||||||
serde = { version = "^1.0", features = ["derive"] }
|
serde = { version = "^1.0", features = ["derive"], optional = true }
|
||||||
thiserror = "1.0.39"
|
thiserror = "^1.0.39"
|
||||||
|
17
src/bus.rs
17
src/bus.rs
@ -53,12 +53,16 @@ pub enum Region {
|
|||||||
|
|
||||||
impl Display for Region {
|
impl Display for Region {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}", match self {
|
write!(
|
||||||
Region::Charset => "charset",
|
f,
|
||||||
Region::Program => "program",
|
"{}",
|
||||||
Region::Screen => "screen",
|
match self {
|
||||||
Region::Stack => "stack",
|
Region::Charset => "charset",
|
||||||
})
|
Region::Program => "program",
|
||||||
|
Region::Screen => "screen",
|
||||||
|
Region::Stack => "stack",
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +192,7 @@ impl Write<u16> for Bus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_feature = "rhexdump")]
|
||||||
impl Display for Bus {
|
impl Display for Bus {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
use rhexdump::Rhexdump;
|
use rhexdump::Rhexdump;
|
||||||
|
Loading…
Reference in New Issue
Block a user