pub struct ShellAutocomplete { /* private fields */ }Expand description
Shell command autocomplete using N-gram Markov model
Implementations§
Source§impl ShellAutocomplete
impl ShellAutocomplete
Sourcepub fn new() -> Result<Self, String>
pub fn new() -> Result<Self, String>
Create a new ShellAutocomplete with the embedded model.
This is a convenience method for testing and demos that loads the model compiled into the binary.
Sourcepub fn load_from_bytes(bytes: &[u8]) -> Result<Self, String>
pub fn load_from_bytes(bytes: &[u8]) -> Result<Self, String>
Load ShellAutocomplete from raw .apr bytes. This is the primary method for loading the model.
Sourcepub fn suggest(&self, prefix: &str, count: usize) -> Vec<(String, f32)>
pub fn suggest(&self, prefix: &str, count: usize) -> Vec<(String, f32)>
Suggest completions for a prefix
Sourcepub fn suggest_json(&self, prefix: &str, count: usize) -> String
pub fn suggest_json(&self, prefix: &str, count: usize) -> String
Get JSON-formatted suggestions (for WASM interop)
Sourcepub fn model_info_json(&self) -> String
pub fn model_info_json(&self) -> String
Get model info as JSON
Sourcepub fn vocab_size(&self) -> usize
pub fn vocab_size(&self) -> usize
Vocabulary size (unique commands)
Sourcepub fn ngram_count(&self) -> usize
pub fn ngram_count(&self) -> usize
N-gram count
Sourcepub fn ngram_size(&self) -> usize
pub fn ngram_size(&self) -> usize
N-gram size
Sourcepub fn estimated_memory_bytes(&self) -> usize
pub fn estimated_memory_bytes(&self) -> usize
Estimated memory usage
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShellAutocomplete
impl RefUnwindSafe for ShellAutocomplete
impl Send for ShellAutocomplete
impl Sync for ShellAutocomplete
impl Unpin for ShellAutocomplete
impl UnsafeUnpin for ShellAutocomplete
impl UnwindSafe for ShellAutocomplete
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