fuse-rust-derive
Derive macro for the Fuseable trait of fuse-rust.
You normally do not depend on this crate directly. Enable the derive feature of
fuse-rust instead, which re-exports the macro:
[]
= { = "0.4", = ["derive"] }
Usage
Mark each searchable field with #[fuse]. Fields without the attribute are ignored,
so a struct may hold ids, counts or anything else non-textual.
use ;
let books = ;
let results = default.search_text_in_fuse_list;
A bare #[fuse] uses the default weight of 1.0:
# use Fuseable;
Rules
- Only structs with named fields are supported. Tuple structs have no field names to look up, and enums have no single set of fields.
- At least one field must be marked
#[fuse]. weightmust be greater than0.0and at most1.0. Weights are combined as1.0 - weight, so values outside that range score nonsensically.- Every marked field must be usable as a
&str;Stringand&strboth work. - Generic parameters and lifetimes on the struct are carried through to the impl.
License
MIT, same as fuse-rust.