pub struct RustCompletionProvider;Expand description
Rust-specific completion provider (fallback)
This is a fallback provider for Rust code when external LSP (rust-analyzer) is unavailable.
§Behavior
Generates Rust-specific completions including:
- Rust keywords (fn, let, mut, const, struct, enum, trait, impl, etc.)
- Rust-specific snippets (function templates, impl blocks, match expressions, etc.)
- Rust traits and standard library types
- Rust macros (println!, format!, vec!, etc.)
- Derive attributes
- Available symbols from code context
§When Used
- External LSP (rust-analyzer) is not configured
- rust-analyzer is not installed or fails to start
- rust-analyzer times out or becomes unresponsive
§Limitations
- No type inference or semantic analysis
- Cannot resolve imports or dependencies
- No project-aware completions
- Cannot determine variable scope or lifetime
- Limited to hardcoded keywords and patterns
§Recommended Configuration
For production-quality Rust completions, install and configure rust-analyzer:
rustup component add rust-analyzerThen configure it in lsp-servers.yaml:
servers:
rust:
- language: rust
executable: rust-analyzer
enabled: trueSee https://github.com/moabualruz/ricecoder/wiki/External-LSP-Configuration.md for details.
Trait Implementations§
Source§impl CompletionProvider for RustCompletionProvider
impl CompletionProvider for RustCompletionProvider
Source§fn generate_completions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_code: &'life1 str,
_position: Position,
context: &'life2 CompletionContext,
) -> Pin<Box<dyn Future<Output = CompletionResult<Vec<CompletionItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn generate_completions<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_code: &'life1 str,
_position: Position,
context: &'life2 CompletionContext,
) -> Pin<Box<dyn Future<Output = CompletionResult<Vec<CompletionItem>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate completions for this language Read more
Auto Trait Implementations§
impl Freeze for RustCompletionProvider
impl RefUnwindSafe for RustCompletionProvider
impl Send for RustCompletionProvider
impl Sync for RustCompletionProvider
impl Unpin for RustCompletionProvider
impl UnwindSafe for RustCompletionProvider
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