Skip to main content

Crate ltrait_sorter_frecency

Crate ltrait_sorter_frecency 

Source
Expand description

This crate implement NewFrecency algorithm for ltrait. See also User:Jesse/NewFrecency on mozilla wiki

Create a database on <XDG_DATA_HOME>/ltrait/frecency/frecency.sqlite

§Example Usage

let config = FrecencyConfig {
    half_life: Duration::from_secs(30 * 60 * 60 * 24), // One month
    type_ident: "simple-test".into(),
};

let launcher = Launcher::default()
    .set_ui(DummyUI, |c| unimplemented!())
    // Cushion is ltrait_sorter_frecency::Context
    .add_raw_sorter(Frecency::new(config.clone())?)
    .add_action(Frecency::new(config)?, |c|
        ltrait_sorter_frecency::Context {
            ident: c.ident.clone(),
            bonus: 15.,
        },
    );

Structs§

Context
The context of ltrait-sorter-frecency The ident must be unique within the same type_ident (if you want it to be judged as different)
Frecency
FrecencyConfig