shared_mime/record.rs
1//! Types representing records in the processed MIME database.
2//!
3//! These records are an intermediate representation between the parsed shared
4//! mime info files (with [crate::runtime]) and the actual MIME type lookup
5//! structures. Serializing these records are an effective way to cache parsed
6//! MIME data.
7use serde::{Deserialize, Serialize};
8
9/// A MIME type record from the shared mime database.
10#[derive(Serialize, Deserialize, Clone, Debug)]
11pub struct MimeTypeRecord {
12 /// The full MIME type (type/subtype).
13 pub name: String,
14 /// The string description of this record.
15 pub description: Option<String>,
16 /// List of globs (with priorities) for the record.
17 pub globs: Vec<GlobRule>,
18 /// List of this record's immediate superclasses.
19 pub superclasses: Vec<String>,
20 /// Aliases for this record.
21 pub aliases: Vec<String>,
22}
23
24/// A glob rule in the database.
25#[derive(Serialize, Deserialize, Clone, Debug)]
26pub struct GlobRule {
27 // Glob pattern.
28 pub pattern: String,
29 // Glob weight.
30 pub weight: i32,
31 // Whether this rule is case-sensitive.
32 pub case_sensitive: bool,
33}