mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
crate::err -> crate::error
This commit is contained in:
parent
8449bbe469
commit
094e4ad461
56 changed files with 69 additions and 69 deletions
|
@ -29,7 +29,7 @@ pub trait Service {
|
||||||
}
|
}
|
||||||
buf.push_str(
|
buf.push_str(
|
||||||
r#"
|
r#"
|
||||||
_ => Err(crate::err::AnkiError::invalid_input("invalid command")),
|
_ => Err(crate::error::AnkiError::invalid_input("invalid command")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
@ -58,7 +58,7 @@ impl prost_build::ServiceGenerator for CustomGenerator {
|
||||||
"pub mod {name}_service {{
|
"pub mod {name}_service {{
|
||||||
use super::*;
|
use super::*;
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
",
|
",
|
||||||
name = service.name.replace("Service", "").to_ascii_lowercase()
|
name = service.name.replace("Service", "").to_ascii_lowercase()
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::storage::SqliteStorage;
|
use crate::storage::SqliteStorage;
|
||||||
use crate::{collection::Collection, err::Result};
|
use crate::{collection::Collection, error::Result};
|
||||||
use rusqlite::types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef};
|
use rusqlite::types::{FromSql, FromSqlError, ToSql, ToSqlOutput, ValueRef};
|
||||||
use rusqlite::OptionalExtension;
|
use rusqlite::OptionalExtension;
|
||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto as pb,
|
backend_proto as pb,
|
||||||
err::{AnkiError, NetworkErrorKind, SyncErrorKind},
|
error::{AnkiError, NetworkErrorKind, SyncErrorKind},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ use crate::{
|
||||||
backend::dbproxy::db_command_bytes,
|
backend::dbproxy::db_command_bytes,
|
||||||
backend_proto as pb,
|
backend_proto as pb,
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
};
|
};
|
||||||
use once_cell::sync::OnceCell;
|
use once_cell::sync::OnceCell;
|
||||||
|
|
|
@ -6,7 +6,7 @@ use tokio::runtime::Runtime;
|
||||||
|
|
||||||
use crate::backend::{Backend, BackendState};
|
use crate::backend::{Backend, BackendState};
|
||||||
use crate::{
|
use crate::{
|
||||||
err::SyncErrorKind,
|
error::SyncErrorKind,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
sync::{
|
sync::{
|
||||||
http::{
|
http::{
|
||||||
|
|
|
@ -6,7 +6,7 @@ use std::sync::Arc;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use serde_repr::{Deserialize_repr, Serialize_repr};
|
use serde_repr::{Deserialize_repr, Serialize_repr};
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result};
|
use crate::error::{AnkiError, Result};
|
||||||
use crate::i18n::I18n;
|
use crate::i18n::I18n;
|
||||||
use crate::{
|
use crate::{
|
||||||
card::{Card, CardId, CardQueue, CardType},
|
card::{Card, CardId, CardQueue, CardType},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
pub(crate) mod undo;
|
pub(crate) mod undo;
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result};
|
use crate::error::{AnkiError, Result};
|
||||||
use crate::notes::NoteId;
|
use crate::notes::NoteId;
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::Collection, config::SchedulerVersion, prelude::*, timestamp::TimestampSecs,
|
collection::Collection, config::SchedulerVersion, prelude::*, timestamp::TimestampSecs,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
storage::SqliteStorage,
|
storage::SqliteStorage,
|
||||||
undo::UndoManager,
|
undo::UndoManager,
|
||||||
};
|
};
|
||||||
use crate::{err::Result, scheduler::queue::CardQueues};
|
use crate::{error::Result, scheduler::queue::CardQueues};
|
||||||
use crate::{i18n::I18n, ops::StateChanges};
|
use crate::{i18n::I18n, ops::StateChanges};
|
||||||
use std::{collections::HashMap, path::PathBuf, sync::Arc};
|
use std::{collections::HashMap, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::SchedulerVersion,
|
config::SchedulerVersion,
|
||||||
err::{AnkiError, DbErrorKind, Result},
|
error::{AnkiError, DbErrorKind, Result},
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
notetype::{
|
notetype::{
|
||||||
all_stock_notetypes, AlreadyGeneratedCardInfo, CardGenContext, Notetype, NotetypeId,
|
all_stock_notetypes, AlreadyGeneratedCardInfo, CardGenContext, Notetype, NotetypeId,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
define_newtype,
|
define_newtype,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
scheduler::states::review::INITIAL_EASE_FACTOR,
|
scheduler::states::review::INITIAL_EASE_FACTOR,
|
||||||
timestamp::{TimestampMillis, TimestampSecs},
|
timestamp::{TimestampMillis, TimestampSecs},
|
||||||
types::Usn,
|
types::Usn,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::{collection::Collection, decks::DeckId, err::Result};
|
use crate::{collection::Collection, decks::DeckId, error::Result};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
deckconf::DeckConfId,
|
deckconf::DeckConfId,
|
||||||
define_newtype,
|
define_newtype,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
text::normalize_to_nfc,
|
text::normalize_to_nfc,
|
||||||
timestamp::TimestampSecs,
|
timestamp::TimestampSecs,
|
||||||
|
@ -693,7 +693,7 @@ mod test {
|
||||||
use crate::decks::reparented_name;
|
use crate::decks::reparented_name;
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::{open_test_collection, Collection},
|
collection::{open_test_collection, Collection},
|
||||||
err::Result,
|
error::Result,
|
||||||
search::SortMode,
|
search::SortMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
config::{BoolKey, SchedulerVersion},
|
config::{BoolKey, SchedulerVersion},
|
||||||
deckconf::{DeckConf, DeckConfId},
|
deckconf::{DeckConf, DeckConfId},
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::Result,
|
error::Result,
|
||||||
timestamp::TimestampSecs,
|
timestamp::TimestampSecs,
|
||||||
};
|
};
|
||||||
use serde_tuple::Serialize_tuple;
|
use serde_tuple::Serialize_tuple;
|
||||||
|
@ -338,7 +338,7 @@ impl Collection {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{collection::open_test_collection, deckconf::DeckConfId, err::Result};
|
use crate::{collection::open_test_collection, deckconf::DeckConfId, error::Result};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn wellformed() -> Result<()> {
|
fn wellformed() -> Result<()> {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
notes::{NoteId, TransformNoteOutput},
|
notes::{NoteId, TransformNoteOutput},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
text::normalize_to_nfc,
|
text::normalize_to_nfc,
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub mod config;
|
||||||
pub mod dbcheck;
|
pub mod dbcheck;
|
||||||
pub mod deckconf;
|
pub mod deckconf;
|
||||||
pub mod decks;
|
pub mod decks;
|
||||||
pub mod err;
|
pub mod error;
|
||||||
pub mod findreplace;
|
pub mod findreplace;
|
||||||
pub mod i18n;
|
pub mod i18n;
|
||||||
pub mod latex;
|
pub mod latex;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result};
|
use crate::error::{AnkiError, Result};
|
||||||
use crate::log::{debug, Logger};
|
use crate::log::{debug, Logger};
|
||||||
use crate::media::database::{MediaDatabaseContext, MediaEntry};
|
use crate::media::database::{MediaDatabaseContext, MediaEntry};
|
||||||
use crate::media::files::{
|
use crate::media::files::{
|
||||||
|
@ -244,7 +244,7 @@ where
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::media::changetracker::ChangeTracker;
|
use crate::media::changetracker::ChangeTracker;
|
||||||
use crate::media::database::MediaEntry;
|
use crate::media::database::MediaEntry;
|
||||||
use crate::media::files::sha1_of_data;
|
use crate::media::files::sha1_of_data;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::collection::Collection;
|
use crate::collection::Collection;
|
||||||
use crate::err::{AnkiError, DbErrorKind, Result};
|
use crate::error::{AnkiError, DbErrorKind, Result};
|
||||||
use crate::latex::extract_latex_expanding_clozes;
|
use crate::latex::extract_latex_expanding_clozes;
|
||||||
use crate::log::debug;
|
use crate::log::debug;
|
||||||
use crate::media::database::MediaDatabaseContext;
|
use crate::media::database::MediaDatabaseContext;
|
||||||
|
@ -511,7 +511,7 @@ pub(crate) mod test {
|
||||||
|
|
||||||
use super::normalize_and_maybe_rename_files;
|
use super::normalize_and_maybe_rename_files;
|
||||||
use crate::collection::{open_collection, Collection};
|
use crate::collection::{open_collection, Collection};
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::i18n::I18n;
|
use crate::i18n::I18n;
|
||||||
use crate::log;
|
use crate::log;
|
||||||
use crate::media::check::{MediaCheckOutput, MediaChecker};
|
use crate::media::check::{MediaCheckOutput, MediaChecker};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
|
use rusqlite::{params, Connection, OptionalExtension, Row, Statement, NO_PARAMS};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -251,7 +251,7 @@ fn row_to_entry(row: &Row) -> rusqlite::Result<MediaEntry> {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::media::database::MediaEntry;
|
use crate::media::database::MediaEntry;
|
||||||
use crate::media::files::sha1_of_data;
|
use crate::media::files::sha1_of_data;
|
||||||
use crate::media::MediaManager;
|
use crate::media::MediaManager;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result};
|
use crate::error::{AnkiError, Result};
|
||||||
use crate::log::{debug, Logger};
|
use crate::log::{debug, Logger};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::media::database::{open_or_create, MediaDatabaseContext, MediaEntry};
|
use crate::media::database::{open_or_create, MediaDatabaseContext, MediaEntry};
|
||||||
use crate::media::files::{add_data_to_folder_uniquely, mtime_as_i64, remove_files, sha1_of_data};
|
use crate::media::files::{add_data_to_folder_uniquely, mtime_as_i64, remove_files, sha1_of_data};
|
||||||
use crate::media::sync::{MediaSyncProgress, MediaSyncer};
|
use crate::media::sync::{MediaSyncProgress, MediaSyncer};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result, SyncErrorKind};
|
use crate::error::{AnkiError, Result, SyncErrorKind};
|
||||||
use crate::media::changetracker::ChangeTracker;
|
use crate::media::changetracker::ChangeTracker;
|
||||||
use crate::media::database::{MediaDatabaseContext, MediaDatabaseMetadata, MediaEntry};
|
use crate::media::database::{MediaDatabaseContext, MediaDatabaseMetadata, MediaEntry};
|
||||||
use crate::media::files::{
|
use crate::media::files::{
|
||||||
|
@ -808,7 +808,7 @@ fn zip_files<'a>(
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::media::sync::{
|
use crate::media::sync::{
|
||||||
determine_required_change, LocalState, MediaSyncProgress, RequiredChange,
|
determine_required_change, LocalState, MediaSyncProgress, RequiredChange,
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
backend_proto as pb,
|
backend_proto as pb,
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
define_newtype,
|
define_newtype,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
notetype::{CardGenContext, NoteField, Notetype, NotetypeId},
|
notetype::{CardGenContext, NoteField, Notetype, NotetypeId},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
template::field_is_empty,
|
template::field_is_empty,
|
||||||
|
@ -570,7 +570,7 @@ fn note_differs_from_db(existing_note: &mut Note, note: &mut Note) -> bool {
|
||||||
mod test {
|
mod test {
|
||||||
use super::{anki_base91, field_checksum};
|
use super::{anki_base91, field_checksum};
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::open_test_collection, config::BoolKey, decks::DeckId, err::Result, prelude::*,
|
collection::open_test_collection, config::BoolKey, decks::DeckId, error::Result, prelude::*,
|
||||||
search::SortMode,
|
search::SortMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
deckconf::{DeckConf, DeckConfId},
|
deckconf::{DeckConf, DeckConfId},
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
notes::{Note, NoteId},
|
notes::{Note, NoteId},
|
||||||
notetype::NotetypeKind,
|
notetype::NotetypeKind,
|
||||||
template::ParsedTemplate,
|
template::ParsedTemplate,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use super::{
|
use super::{
|
||||||
cardgen::group_generated_cards_by_note, CardGenContext, Notetype, NotetypeId, NotetypeKind,
|
cardgen::group_generated_cards_by_note, CardGenContext, Notetype, NotetypeId, NotetypeKind,
|
||||||
};
|
};
|
||||||
use crate::{card::CardId, collection::Collection, err::Result, notes::NoteId};
|
use crate::{card::CardId, collection::Collection, error::Result, notes::NoteId};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto::{NoteField as NoteFieldProto, NoteFieldConfig, OptionalUInt32},
|
backend_proto::{NoteField as NoteFieldProto, NoteFieldConfig, OptionalUInt32},
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
|
|
@ -26,7 +26,7 @@ use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
define_newtype,
|
define_newtype,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
notes::Note,
|
notes::Note,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
template::{FieldRequirements, ParsedTemplate},
|
template::{FieldRequirements, ParsedTemplate},
|
||||||
|
|
|
@ -5,7 +5,7 @@ use super::{CardTemplate, Notetype, NotetypeKind};
|
||||||
use crate::{
|
use crate::{
|
||||||
card::{Card, CardId},
|
card::{Card, CardId},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
notes::{Note, NoteId},
|
notes::{Note, NoteId},
|
||||||
template::{field_is_empty, render_card, ParsedTemplate, RenderedNode},
|
template::{field_is_empty, render_card, ParsedTemplate, RenderedNode},
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use super::{CardGenContext, Notetype};
|
use super::{CardGenContext, Notetype};
|
||||||
use crate::{collection::Collection, err::Result};
|
use crate::{collection::Collection, error::Result};
|
||||||
|
|
||||||
/// True if any ordinals added, removed or reordered.
|
/// True if any ordinals added, removed or reordered.
|
||||||
fn ords_changed(ords: &[Option<u32>], previous_len: usize) -> bool {
|
fn ords_changed(ords: &[Option<u32>], previous_len: usize) -> bool {
|
||||||
|
@ -137,7 +137,7 @@ impl Collection {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::{ords_changed, TemplateOrdChanges};
|
use super::{ords_changed, TemplateOrdChanges};
|
||||||
use crate::{collection::open_test_collection, decks::DeckId, err::Result, search::SortMode};
|
use crate::{collection::open_test_collection, decks::DeckId, error::Result, search::SortMode};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ord_changes() {
|
fn ord_changes() {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use super::NotetypeKind;
|
use super::NotetypeKind;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ConfigEntry, ConfigKey},
|
config::{ConfigEntry, ConfigKey},
|
||||||
err::Result,
|
error::Result,
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
notetype::Notetype,
|
notetype::Notetype,
|
||||||
storage::SqliteStorage,
|
storage::SqliteStorage,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto::{CardTemplate as CardTemplateProto, CardTemplateConfig, OptionalUInt32},
|
backend_proto::{CardTemplate as CardTemplateProto, CardTemplateConfig, OptionalUInt32},
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
template::ParsedTemplate,
|
template::ParsedTemplate,
|
||||||
timestamp::TimestampSecs,
|
timestamp::TimestampSecs,
|
||||||
types::Usn,
|
types::Usn,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::BoolKey,
|
config::BoolKey,
|
||||||
err::Result,
|
error::Result,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
scheduler::timing::local_minutes_west_for_stamp,
|
scheduler::timing::local_minutes_west_for_stamp,
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub use crate::{
|
||||||
config::BoolKey,
|
config::BoolKey,
|
||||||
deckconf::{DeckConf, DeckConfId},
|
deckconf::{DeckConf, DeckConfId},
|
||||||
decks::{Deck, DeckId, DeckKind},
|
decks::{Deck, DeckId, DeckKind},
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
notes::{Note, NoteId},
|
notes::{Note, NoteId},
|
||||||
notetype::{Notetype, NotetypeId},
|
notetype::{Notetype, NotetypeId},
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
card::{Card, CardId, CardQueue},
|
card::{Card, CardId, CardQueue},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::SchedulerVersion,
|
config::SchedulerVersion,
|
||||||
err::Result,
|
error::Result,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
search::SortMode,
|
search::SortMode,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::{collection::Collection, config::SchedulerVersion, err::Result, prelude::*};
|
use crate::{collection::Collection, config::SchedulerVersion, error::Result, prelude::*};
|
||||||
|
|
||||||
pub mod answering;
|
pub mod answering;
|
||||||
pub mod bury_and_suspend;
|
pub mod bury_and_suspend;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
card::{Card, CardId, CardQueue, CardType},
|
card::{Card, CardId, CardQueue, CardType},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::Result,
|
error::Result,
|
||||||
notes::NoteId,
|
notes::NoteId,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
search::SortMode,
|
search::SortMode,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::StringKey,
|
config::StringKey,
|
||||||
deckconf::INITIAL_EASE_FACTOR_THOUSANDS,
|
deckconf::INITIAL_EASE_FACTOR_THOUSANDS,
|
||||||
err::Result,
|
error::Result,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
|
@ -18,7 +18,7 @@ use crate::{
|
||||||
card::CardType,
|
card::CardType,
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
config::{BoolKey, SortKind},
|
config::{BoolKey, SortKind},
|
||||||
err::Result,
|
error::Result,
|
||||||
notes::NoteId,
|
notes::NoteId,
|
||||||
prelude::AnkiError,
|
prelude::AnkiError,
|
||||||
search::parser::parse,
|
search::parser::parse,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::{ParseError, Result, SearchErrorKind as FailKind},
|
error::{ParseError, Result, SearchErrorKind as FailKind},
|
||||||
notetype::NotetypeId,
|
notetype::NotetypeId,
|
||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -696,7 +696,7 @@ fn is_parser_escape(txt: &str) -> bool {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::err::SearchErrorKind;
|
use crate::error::SearchErrorKind;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors() {
|
fn errors() {
|
||||||
use crate::err::AnkiError;
|
use crate::error::AnkiError;
|
||||||
use FailKind::*;
|
use FailKind::*;
|
||||||
|
|
||||||
fn assert_err_kind(input: &str, kind: FailKind) {
|
fn assert_err_kind(input: &str, kind: FailKind) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
||||||
card::{CardQueue, CardType},
|
card::{CardQueue, CardType},
|
||||||
collection::Collection,
|
collection::Collection,
|
||||||
decks::human_deck_name_to_native,
|
decks::human_deck_name_to_native,
|
||||||
err::Result,
|
error::Result,
|
||||||
notes::field_checksum,
|
notes::field_checksum,
|
||||||
notetype::NotetypeId,
|
notetype::NotetypeId,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
|
|
@ -187,7 +187,7 @@ pub(crate) fn normalize_search(input: &str) -> Result<String> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::search::parse_search as parse;
|
use crate::search::parse_search as parse;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::{
|
||||||
card::{Card, CardId, CardQueue, CardType},
|
card::{Card, CardId, CardQueue, CardType},
|
||||||
deckconf::DeckConfId,
|
deckconf::DeckConfId,
|
||||||
decks::{Deck, DeckId, DeckKind},
|
decks::{Deck, DeckId, DeckKind},
|
||||||
err::Result,
|
error::Result,
|
||||||
notes::NoteId,
|
notes::NoteId,
|
||||||
scheduler::{
|
scheduler::{
|
||||||
congrats::CongratsInfo,
|
congrats::CongratsInfo,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use super::SqliteStorage;
|
use super::SqliteStorage;
|
||||||
use crate::{config::ConfigEntry, err::Result, timestamp::TimestampSecs, types::Usn};
|
use crate::{config::ConfigEntry, error::Result, timestamp::TimestampSecs, types::Usn};
|
||||||
use rusqlite::{params, NO_PARAMS};
|
use rusqlite::{params, NO_PARAMS};
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::{
|
||||||
config::SchedulerVersion,
|
config::SchedulerVersion,
|
||||||
decks::immediate_parent_name,
|
decks::immediate_parent_name,
|
||||||
decks::{Deck, DeckCommon, DeckId, DeckKindProto, DeckSchema11, DueCounts},
|
decks::{Deck, DeckCommon, DeckId, DeckKindProto, DeckSchema11, DueCounts},
|
||||||
err::{AnkiError, DbErrorKind, Result},
|
error::{AnkiError, DbErrorKind, Result},
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
timestamp::TimestampMillis,
|
timestamp::TimestampMillis,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use super::SqliteStorage;
|
use super::SqliteStorage;
|
||||||
use crate::{
|
use crate::{
|
||||||
deckconf::{DeckConf, DeckConfId, DeckConfSchema11, DeckConfigInner},
|
deckconf::{DeckConf, DeckConfId, DeckConfSchema11, DeckConfigInner},
|
||||||
err::Result,
|
error::Result,
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
};
|
};
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use super::SqliteStorage;
|
||||||
use crate::{
|
use crate::{
|
||||||
card::CardId,
|
card::CardId,
|
||||||
decks::DeckId,
|
decks::DeckId,
|
||||||
err::{AnkiError, Result},
|
error::{AnkiError, Result},
|
||||||
notes::NoteId,
|
notes::NoteId,
|
||||||
sync::Graves,
|
sync::Graves,
|
||||||
types::Usn,
|
types::Usn,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
err::Result,
|
error::Result,
|
||||||
notes::{Note, NoteId, NoteTags},
|
notes::{Note, NoteId, NoteTags},
|
||||||
notetype::NotetypeId,
|
notetype::NotetypeId,
|
||||||
tags::{join_tags, split_tags},
|
tags::{join_tags, split_tags},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use super::{ids_to_string, SqliteStorage};
|
use super::{ids_to_string, SqliteStorage};
|
||||||
use crate::{
|
use crate::{
|
||||||
err::{AnkiError, DbErrorKind, Result},
|
error::{AnkiError, DbErrorKind, Result},
|
||||||
notes::NoteId,
|
notes::NoteId,
|
||||||
notetype::{
|
notetype::{
|
||||||
AlreadyGeneratedCardInfo, CardTemplate, CardTemplateConfig, NoteField, NoteFieldConfig,
|
AlreadyGeneratedCardInfo, CardTemplate, CardTemplateConfig, NoteField, NoteFieldConfig,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use super::SqliteStorage;
|
use super::SqliteStorage;
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::{
|
use crate::{
|
||||||
backend_proto as pb,
|
backend_proto as pb,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::config::schema11::schema11_config_as_string;
|
use crate::config::schema11::schema11_config_as_string;
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
use crate::err::{AnkiError, DbErrorKind};
|
use crate::error::{AnkiError, DbErrorKind};
|
||||||
use crate::timestamp::{TimestampMillis, TimestampSecs};
|
use crate::timestamp::{TimestampMillis, TimestampSecs};
|
||||||
use crate::{i18n::I18n, scheduler::timing::v1_creation_date, text::without_combining};
|
use crate::{i18n::I18n, scheduler::timing::v1_creation_date, text::without_combining};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
err::SyncErrorKind,
|
error::SyncErrorKind,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
sync::{SanityCheckCounts, SanityCheckDueCounts},
|
sync::{SanityCheckCounts, SanityCheckDueCounts},
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use super::SqliteStorage;
|
use super::SqliteStorage;
|
||||||
use crate::{err::Result, tags::Tag, types::Usn};
|
use crate::{error::Result, tags::Tag, types::Usn};
|
||||||
|
|
||||||
use rusqlite::{params, Row, NO_PARAMS};
|
use rusqlite::{params, Row, NO_PARAMS};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub(super) const SCHEMA_STARTING_VERSION: u8 = 11;
|
||||||
pub(super) const SCHEMA_MAX_VERSION: u8 = 18;
|
pub(super) const SCHEMA_MAX_VERSION: u8 = 18;
|
||||||
|
|
||||||
use super::SqliteStorage;
|
use super::SqliteStorage;
|
||||||
use crate::err::Result;
|
use crate::error::Result;
|
||||||
|
|
||||||
impl SqliteStorage {
|
impl SqliteStorage {
|
||||||
pub(super) fn upgrade_to_latest_schema(&self, ver: u8, server: bool) -> Result<()> {
|
pub(super) fn upgrade_to_latest_schema(&self, ver: u8, server: bool) -> Result<()> {
|
||||||
|
|
|
@ -6,7 +6,7 @@ use super::{
|
||||||
Chunk, FullSyncProgress, Graves, SanityCheckCounts, SanityCheckOut, SyncMeta, UnchunkedChanges,
|
Chunk, FullSyncProgress, Graves, SanityCheckCounts, SanityCheckOut, SyncMeta, UnchunkedChanges,
|
||||||
};
|
};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::{err::SyncErrorKind, notes::guid, version::sync_client_version};
|
use crate::{error::SyncErrorKind, notes::guid, version::sync_client_version};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use flate2::write::GzEncoder;
|
use flate2::write::GzEncoder;
|
||||||
|
@ -349,7 +349,7 @@ fn sync_endpoint(host_number: u32) -> String {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{err::SyncErrorKind, sync::SanityCheckDueCounts};
|
use crate::{error::SyncErrorKind, sync::SanityCheckDueCounts};
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
async fn http_client_inner(username: String, password: String) -> Result<()> {
|
async fn http_client_inner(username: String, password: String) -> Result<()> {
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
card::{Card, CardQueue, CardType},
|
card::{Card, CardQueue, CardType},
|
||||||
deckconf::DeckConfSchema11,
|
deckconf::DeckConfSchema11,
|
||||||
decks::DeckSchema11,
|
decks::DeckSchema11,
|
||||||
err::SyncErrorKind,
|
error::SyncErrorKind,
|
||||||
notes::Note,
|
notes::Note,
|
||||||
notetype::{Notetype, NotetypeSchema11},
|
notetype::{Notetype, NotetypeSchema11},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::err::{AnkiError, Result, TemplateError};
|
use crate::error::{AnkiError, Result, TemplateError};
|
||||||
use crate::i18n::I18n;
|
use crate::i18n::I18n;
|
||||||
use crate::{cloze::add_cloze_numbers_in_string, template_filters::apply_filters};
|
use crate::{cloze::add_cloze_numbers_in_string, template_filters::apply_filters};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -793,7 +793,7 @@ fn find_fields_with_filter<'a>(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::{FieldMap, ParsedNode::*, ParsedTemplate as PT};
|
use super::{FieldMap, ParsedNode::*, ParsedTemplate as PT};
|
||||||
use crate::err::TemplateError;
|
use crate::error::TemplateError;
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::I18n,
|
i18n::I18n,
|
||||||
template::{field_is_empty, nonempty_fields, FieldRequirements, RenderContext},
|
template::{field_is_empty, nonempty_fields, FieldRequirements, RenderContext},
|
||||||
|
|
Loading…
Reference in a new issue