Mark highlight_dynamic_prompt as deprecated
And fix example.
diff --git a/examples/example.rs b/examples/example.rs
index ce41cf4..e02f665 100644
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -35,8 +35,12 @@
}
impl Highlighter for MyHelper {
- fn highlight_prompt<'p>(&self, _: &str) -> Cow<'static, str> {
- Borrowed(COLORED_PROMPT)
+ fn highlight_prompt<'p>(&self, prompt: &'p str) -> Cow<'p, str> {
+ if prompt == PROMPT {
+ Borrowed(COLORED_PROMPT)
+ } else {
+ Borrowed(prompt)
+ }
}
fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> {
diff --git a/src/highlight.rs b/src/highlight.rs
index c09e5e1..7ecba81 100644
--- a/src/highlight.rs
+++ b/src/highlight.rs
@@ -26,6 +26,7 @@
}
/// Takes the dynamic `prompt` and
/// returns the highlighted version (with ANSI color).
+ #[deprecated(since="2.0.1", note="please use `highlight_prompt` instead")]
fn highlight_dynamic_prompt<'p>(&self, prompt: &'p str) -> Cow<'p, str> {
Borrowed(prompt)
}