suggest_with_fallback

Function suggest_with_fallback 

Source
pub fn suggest_with_fallback(
    prefix: &str,
    model: Option<&MarkovModel>,
    config: &ShellConfig,
) -> Vec<(String, f32)>
Expand description

Suggestion with graceful degradation and timeout handling.

This function applies all hardening measures:

  • Prefix truncation if too long
  • Timeout-based suggestion generation
  • Quality filtering
  • Security filtering
  • Result limiting

§Arguments

  • prefix - The command prefix to complete
  • model - Optional model reference (returns empty if None)
  • config - Configuration with limits

§Example

use aprender_shell::config::{ShellConfig, suggest_with_fallback};
use aprender_shell::model::MarkovModel;

let config = ShellConfig::fast();
// Without model - returns empty
let suggestions = suggest_with_fallback("git ", None, &config);
assert!(suggestions.is_empty());