Struct fuse_rust::FuseProperty
source · pub struct FuseProperty {
pub value: String,
pub weight: f64,
}
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.
Implementations§
source§impl FuseProperty
impl FuseProperty
Auto Trait Implementations§
impl RefUnwindSafe for FuseProperty
impl Send for FuseProperty
impl Sync for FuseProperty
impl Unpin for FuseProperty
impl UnwindSafe for FuseProperty
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