pub struct CqlCompleter {
cache: Arc<RwLock<SchemaCache>>,
current_keyspace: Arc<RwLock<Option<String>>>,
rt_handle: Handle,
colorizer: CqlColorizer,
}Expand description
Tab completer for the CQL shell REPL.
Fields§
§cache: Arc<RwLock<SchemaCache>>Shared schema cache for keyspace/table/column lookups.
current_keyspace: Arc<RwLock<Option<String>>>Current keyspace (shared with session via USE command).
rt_handle: HandleTokio runtime handle for blocking cache reads inside sync complete().
colorizer: CqlColorizerSyntax colorizer for highlighting.
Implementations§
Source§impl CqlCompleter
impl CqlCompleter
Sourcepub fn new(
cache: Arc<RwLock<SchemaCache>>,
current_keyspace: Arc<RwLock<Option<String>>>,
rt_handle: Handle,
color_enabled: bool,
) -> Self
pub fn new( cache: Arc<RwLock<SchemaCache>>, current_keyspace: Arc<RwLock<Option<String>>>, rt_handle: Handle, color_enabled: bool, ) -> Self
Create a new completer with shared cache and keyspace state.
Sourcefn detect_context(&self, line: &str, pos: usize) -> CompletionContext
fn detect_context(&self, line: &str, pos: usize) -> CompletionContext
Detect completion context from the input line up to the cursor position.
Sourcefn complete_for_context(
&self,
ctx: &CompletionContext,
prefix: &str,
) -> Vec<Pair>
fn complete_for_context( &self, ctx: &CompletionContext, prefix: &str, ) -> Vec<Pair>
Generate completions for the detected context.
Trait Implementations§
Source§impl Completer for CqlCompleter
impl Completer for CqlCompleter
Source§impl Highlighter for CqlCompleter
impl Highlighter for CqlCompleter
Source§fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str>
fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str>
Takes the currently edited
line with the cursor position and
returns the highlighted version (with ANSI color). Read moreSource§fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
&'s self,
prompt: &'p str,
_default: bool,
) -> Cow<'b, str>
fn highlight_prompt<'b, 's: 'b, 'p: 'b>( &'s self, prompt: &'p str, _default: bool, ) -> Cow<'b, str>
Takes the
prompt and
returns the highlighted version (with ANSI color).Source§fn highlight_char(&self, _line: &str, _pos: usize, _forced: CmdKind) -> bool
fn highlight_char(&self, _line: &str, _pos: usize, _forced: CmdKind) -> bool
Tells if
line needs to be highlighted when a specific char is typed or
when cursor is moved under a specific char. Read more§fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>
fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str>
Takes the
hint and
returns the highlighted version (with ANSI color).Source§impl Hinter for CqlCompleter
impl Hinter for CqlCompleter
Source§impl Validator for CqlCompleter
impl Validator for CqlCompleter
§fn validate(
&self,
ctx: &mut ValidationContext<'_>,
) -> Result<ValidationResult, ReadlineError>
fn validate( &self, ctx: &mut ValidationContext<'_>, ) -> Result<ValidationResult, ReadlineError>
Takes the currently edited
input and returns a
ValidationResult indicating whether it is valid or not along
with an option message to display about the result. The most
common validity check to implement is probably whether the
input is complete or not, for instance ensuring that all
delimiters are fully balanced. Read more§fn validate_while_typing(&self) -> bool
fn validate_while_typing(&self) -> bool
Configure whether validation is performed while typing or only
when user presses the Enter key. Read more
impl Helper for CqlCompleter
Auto Trait Implementations§
impl Freeze for CqlCompleter
impl !RefUnwindSafe for CqlCompleter
impl Send for CqlCompleter
impl Sync for CqlCompleter
impl Unpin for CqlCompleter
impl !UnwindSafe for CqlCompleter
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