pub struct CqlColorizer {
enabled: bool,
}Expand description
CQL syntax colorizer using ANSI escape codes.
Fields§
§enabled: boolImplementations§
Source§impl CqlColorizer
impl CqlColorizer
Sourcepub fn new(enabled: bool) -> Self
pub fn new(enabled: bool) -> Self
Create a new colorizer. If enabled is false, all methods return input unchanged.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether colorization is enabled.
Sourcepub fn colorize_value(&self, value: &CqlValue) -> String
pub fn colorize_value(&self, value: &CqlValue) -> String
Colorize a CQL result value matching Python cqlsh’s color scheme.
Color mapping:
- Text/Ascii → yellow bold
- Numeric/boolean/uuid/timestamp/date/time/duration/inet → green bold
- Blob → dark magenta (non-bold)
- Null → red bold
- Collection delimiters → blue bold, inner values colored by type
Sourcepub fn colorize_header(&self, name: &str) -> String
pub fn colorize_header(&self, name: &str) -> String
Colorize a column header (magenta bold, matching Python cqlsh default).
Sourcepub fn colorize_error(&self, msg: &str) -> String
pub fn colorize_error(&self, msg: &str) -> String
Colorize an error message (red bold, matching Python cqlsh).
Sourcepub fn colorize_warning(&self, msg: &str) -> String
pub fn colorize_warning(&self, msg: &str) -> String
Colorize a warning message (red bold, matching Python cqlsh).
Sourcepub fn colorize_trace_label(&self, label: &str) -> String
pub fn colorize_trace_label(&self, label: &str) -> String
Colorize the “Tracing session:” label (magenta bold).
Sourcepub fn colorize_cluster_name(&self, name: &str) -> String
pub fn colorize_cluster_name(&self, name: &str) -> String
Colorize the cluster name in the welcome message (blue bold).
Sourcefn colorize_value_inner(&self, value: &CqlValue) -> String
fn colorize_value_inner(&self, value: &CqlValue) -> String
Inner recursive value colorizer.
Sourcefn colorize_collection_element(&self, value: &CqlValue) -> String
fn colorize_collection_element(&self, value: &CqlValue) -> String
Colorize an element inside a collection, quoting strings like Display does.
Sourcepub fn colorize_line(&self, line: &str) -> String
pub fn colorize_line(&self, line: &str) -> String
Colorize a line of CQL input for display.
Applies colors:
- CQL keywords → bold blue
- String literals (‘…’) → green
- Numbers → cyan
- Comments (– …) → dark grey
Auto Trait Implementations§
impl Freeze for CqlColorizer
impl RefUnwindSafe for CqlColorizer
impl Send for CqlColorizer
impl Sync for CqlColorizer
impl Unpin for CqlColorizer
impl UnwindSafe for CqlColorizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more