aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2024-06-23 01:59:12 -0700
committeriximeow <me@iximeow.net>2024-06-23 01:59:12 -0700
commitb6070a6fa4cde012028f6d74c94436c86d79df43 (patch)
tree127f9813f92850c758a8d8cc9f0d3158adfce5ea /src
parent0357471015bbbe54023a6b729d4d13361d8835b8 (diff)
deprecate ShowContextual, document changes to colors/color_new modules
Diffstat (limited to 'src')
-rw-r--r--src/display.rs22
-rw-r--r--src/lib.rs20
2 files changed, 22 insertions, 20 deletions
diff --git a/src/display.rs b/src/display.rs
index 3965bdc..754d3e6 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -44,36 +44,36 @@ pub enum NumberStyleHint {
}
#[deprecated(since="0.3.0", note="format_number_i32 is both slow and incorrect: YaxColors may not result in correct styling when writing anywhere other than a terminal, and both stylin and formatting does not inline as well as initially expected. see DisplaySink instead.")]
-pub fn format_number_i32<W: fmt::Write, Y: YaxColors>(colors: &Y, f: &mut W, i: i32, hint: NumberStyleHint) -> fmt::Result {
+pub fn format_number_i32<W: fmt::Write, Y: YaxColors>(_colors: &Y, f: &mut W, i: i32, hint: NumberStyleHint) -> fmt::Result {
match hint {
NumberStyleHint::Signed => {
- write!(f, "{}", colors.number(i))
+ write!(f, "{}", (i))
},
NumberStyleHint::HexSigned => {
- write!(f, "{}", colors.number(signed_i32_hex(i)))
+ write!(f, "{}", signed_i32_hex(i))
},
NumberStyleHint::Unsigned => {
- write!(f, "{}", colors.number(i as u32))
+ write!(f, "{}", i as u32)
},
NumberStyleHint::HexUnsigned => {
- write!(f, "{}", colors.number(u32_hex(i as u32)))
+ write!(f, "{}", u32_hex(i as u32))
},
NumberStyleHint::SignedWithSignSplit => {
if i == core::i32::MIN {
- write!(f, "- {}", colors.number("2147483647"))
+ write!(f, "- {}", "2147483647")
} else if i < 0 {
- write!(f, "- {}", colors.number(-Wrapping(i)))
+ write!(f, "- {}", -Wrapping(i))
} else {
- write!(f, "+ {}", colors.number(i))
+ write!(f, "+ {}", i)
}
}
NumberStyleHint::HexSignedWithSignSplit => {
if i == core::i32::MIN {
- write!(f, "- {}", colors.number("0x7fffffff"))
+ write!(f, "- {}", ("0x7fffffff"))
} else if i < 0 {
- write!(f, "- {}", colors.number(u32_hex((-Wrapping(i)).0 as u32)))
+ write!(f, "- {}", u32_hex((-Wrapping(i)).0 as u32))
} else {
- write!(f, "+ {}", colors.number(u32_hex(i as u32)))
+ write!(f, "+ {}", u32_hex(i as u32))
}
},
NumberStyleHint::HexSignedWithSign => {
diff --git a/src/lib.rs b/src/lib.rs
index 3af5f00..f5b6ea6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,12 +1,14 @@
#![no_std]
#![doc = include_str!("../README.md")]
+#[cfg(feature = "alloc")]
+extern crate alloc;
+
use core::fmt::{self, Debug, Display};
use core::hash::Hash;
#[cfg(feature="use-serde")]
#[macro_use] extern crate serde_derive;
-
#[cfg(feature="use-serde")]
use serde::{Serialize, Deserialize};
@@ -18,24 +20,22 @@ pub use address::AddrParse;
pub mod annotation;
+#[deprecated(since="0.3.0", note="yaxpeax_arch::color conflates output mechanism and styling, leaving it brittle and overly-restrictive. see `yaxpeax_arch::color_new`, which will replace `color` in a future version.")]
mod color;
+#[allow(deprecated)] // allow exporting the deprecated items here to not break downstreams even further...
pub use color::{Colorize, NoColors, YaxColors};
-
-#[cfg(feature="colors")]
-pub use color::ColorSettings;
-
-#[cfg(feature = "alloc")]
-extern crate alloc;
+#[cfg(feature="color-new")]
+pub mod color_new;
pub mod display;
-pub mod testkit;
-
mod reader;
pub use reader::{Reader, ReaderBuilder, ReadError, U8Reader, U16le, U16be, U32le, U32be, U64le, U64be};
pub mod safer_unchecked;
+pub mod testkit;
+
/// the minimum set of errors a `yaxpeax-arch` disassembler may produce.
///
/// it is permissible for an implementer of `DecodeError` to have items that return `false` for
@@ -235,6 +235,8 @@ pub trait Instruction {
fn well_defined(&self) -> bool;
}
+#[allow(deprecated)]
+#[deprecated(since="0.3.0", note="ShowContextual ties YaxColors and fmt::Write in a way that only sometimes composes. simultaneously, it is too generic on Ctx, making it difficult to implement and use. it will be revisited in the future.")]
pub trait ShowContextual<Addr, Ctx: ?Sized, T: fmt::Write, Y: YaxColors> {
fn contextualize(&self, colors: &Y, address: Addr, context: Option<&Ctx>, out: &mut T) -> fmt::Result;
}