Struct fuse_rust::FuseProperty [−][src]
Expand description
Defines the fuseproperty object to be returned as part of the list returned by properties() implemented by the Fuseable trait.
Examples:
Basic Usage:
use fuse_rust::{ Fuse, Fuseable, FuseProperty };
struct Book<'a> {
title: &'a str,
author: &'a str,
}
impl Fuseable for Book<'_>{
fn properties(&self) -> Vec<FuseProperty> {
return vec!(
FuseProperty{value: String::from("title"), weight: 0.3},
FuseProperty{value: String::from("author"), weight: 0.7},
)
}
fn lookup(&self, key: &str) -> Option<&str> {
return match key {
"title" => Some(self.title),
"author" => Some(self.author),
_ => None
}
}
}
Fields
value: String
The name of the field with an associated weight in the search.
weight: f64
The weight associated with the specified field.