/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
usecrate::Error; use rusqlite::{types::ToSqlOutput, ToSql};
/// Different kinds of interest vectors that we store for the user /// /// The aspiration is to add more kinds and store more kinds of interest vectors, e.g.: /// - Full history existence -- does a URL appear anywhere in the user's history? /// - Open tabs -- does a URL appear in the user's open tabs? /// - Bookmarks -- does a URL appear in the user's bookmarks #[derive(Debug, Clone, Copy)] #[repr(u32)] pubenum InterestVectorKind { // Calculated by checking the URLs in the user's frecency list against the topsite domains, // categorized using Tranco.
Frecency = 1,
}
/// List of possible interests for a domain. Domains can have be associated with one or multiple /// interests. `Inconclusive` is used for domains in the user's top sites that we can't classify /// because there's no corresponding entry in the interest database. #[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord, uniffi::Enum)] #[repr(u32)] pubenum Interest { // Note: if you change these codes, make sure to update the `TryFrom<u32>` implementation and // the `test_interest_code_conversion` test.
Inconclusive = 0,
Animals = 1,
Arts = 2,
Autos = 3,
Business = 4,
Career = 5,
Education = 6,
Fashion = 7,
Finance = 8,
Food = 9,
Government = 10, //Disable this per policy consultation // Health = 11,
Hobbies = 12,
Home = 13,
News = 14,
RealEstate = 15,
Society = 16,
Sports = 17,
Tech = 18,
Travel = 19,
}
impl From<Interest> for u32 { fn from(interest: Interest) -> Self {
interest as u32
}
}
impl From<Interest> for usize { fn from(interest: Interest) -> Self {
interest as usize
}
}
impl TryFrom<u32> for Interest { // On error, return the invalid code back type Error = Error;
#[test] fn test_interest_code_conversion() { for interest in Interest::all() {
assert_eq!(Interest::try_from(u32::from(interest)).unwrap(), interest)
} // try_from() for out of bounds codes should return an error
assert!(matches!(
Interest::try_from(20),
Err(Error::InvalidInterestCode(20))
));
assert!(matches!(
Interest::try_from(100),
Err(Error::InvalidInterestCode(100))
)); // Health is currently disabled, so it's code should return None for now
assert!(matches!(
Interest::try_from(11),
Err(Error::InvalidInterestCode(11))
));
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.22 Sekunden
(vorverarbeitet am 2026-06-19)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.