Skip to content

Commit 030cf9a

Browse files
committed
Bold displaying of columns headers, docsting for WrapperDisplay
1 parent 5a57079 commit 030cf9a

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

scylla/src/transport/query_result.rs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ impl fmt::Display for RowsDisplayer<'_> {
759759
// ).collect();
760760

761761
table = table.with(Colorization::exact(
762-
[Color::FG_MAGENTA],
762+
[Color::FG_MAGENTA | Color::BOLD],
763763
tabled::settings::object::Rows::first(),
764764
));
765765
// .with(Colorization::columns(colum_colors))
@@ -785,6 +785,7 @@ struct RowsDisplayerSettings {
785785
colors: ValueColors,
786786
}
787787

788+
788789
impl RowsDisplayerSettings {
789790
fn new() -> Self {
790791
// TODO write Default trait
@@ -867,12 +868,43 @@ pub enum ByteDisplaying {
867868

868869
// wrappers for scylla datatypes implementing Display
869870

871+
872+
/// A wrapper struct for displaying various Scylla CQL value types with custom formatting settings.
873+
///
874+
/// This struct is used to format and display different CQL value types according to the provided
875+
/// display settings. It supports various formatting options such as color usage, byte display format,
876+
/// exponent display for floats and integers, and precision for doubles.
877+
///
878+
/// # Type Parameters
879+
///
880+
/// - `T`: The type of the value to be displayed.
881+
///
882+
/// # Fields
883+
///
884+
/// - `value`: A reference to the value to be displayed.
885+
/// - `settings`: A reference to the display settings to be used for formatting.
886+
///
887+
/// # Example
888+
///
889+
/// ```rust
890+
/// use scylla::transport::query_result::{WrapperDisplay, RowsDisplayerSettings};
891+
///
892+
/// let settings = RowsDisplayerSettings::new();
893+
/// let value = 42;
894+
/// let wrapper = WrapperDisplay { value: &value, settings: &settings };
895+
/// println!("{}", wrapper);
896+
/// ```
897+
///
898+
/// This will print the value `42` formatted according to the provided settings.
899+
870900
struct WrapperDisplay<'a, T: 'a> {
871901
value: &'a T,
872902
settings: &'a RowsDisplayerSettings,
873903
}
874904

875-
// Trait bound to ensure From<WrapperDisplay<T>> for String is implemented
905+
/// A trait for types that can be converted to a `String`.
906+
///
907+
/// Trait bound to ensure From<WrapperDisplay<T>> for String is implemented
876908
trait StringConvertible<'a>: 'a + fmt::Display {
877909
fn to_string(&self) -> String;
878910
}

0 commit comments

Comments
 (0)