mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
Searches that require multiple deck or note type lookups won't perform very well at the moment - it either needs caching or to be split up at the DB level. Nothing tested yet.
39 lines
979 B
Rust
39 lines
979 B
Rust
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
use crate::types::ObjID;
|
|
use serde_aux::field_attributes::deserialize_number_from_string;
|
|
use serde_derive::Deserialize;
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub(crate) struct NoteType {
|
|
#[serde(deserialize_with = "deserialize_number_from_string")]
|
|
pub id: ObjID,
|
|
pub name: String,
|
|
#[serde(rename = "sortf")]
|
|
pub sort_field_idx: u16,
|
|
#[serde(rename = "latexsvg", default)]
|
|
pub latex_svg: bool,
|
|
#[serde(rename = "tmpls")]
|
|
pub templates: Vec<CardTemplate>,
|
|
#[serde(rename = "flds")]
|
|
pub fields: Vec<NoteField>,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub(crate) struct CardTemplate {
|
|
pub name: String,
|
|
pub ord: u16,
|
|
}
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
pub(crate) struct NoteField {
|
|
pub name: String,
|
|
pub ord: u16,
|
|
}
|
|
|
|
impl NoteType {
|
|
pub fn latex_uses_svg(&self) -> bool {
|
|
self.latex_svg
|
|
}
|
|
}
|