Struct fuse_rust::FuseProperty[][src]

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

create a fuse property with weight 1.0 and a string reference.

create a fuse property with a specified weight and string reference.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.