diff --git a/rslib/src/backend/adding.rs b/rslib/src/backend/adding.rs index 261d7ce13..2f81c056b 100644 --- a/rslib/src/backend/adding.rs +++ b/rslib/src/backend/adding.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{adding::DeckAndNotetype, backend_proto::DeckAndNotetype as DeckAndNotetypeProto}; +use crate::{adding::DeckAndNotetype, pb::DeckAndNotetype as DeckAndNotetypeProto}; impl From for DeckAndNotetypeProto { fn from(s: DeckAndNotetype) -> Self { diff --git a/rslib/src/backend/card.rs b/rslib/src/backend/card.rs index 76d00daa4..fad64614d 100644 --- a/rslib/src/backend/card.rs +++ b/rslib/src/backend/card.rs @@ -2,10 +2,10 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::cards_service::Service as CardsService; +pub(super) use crate::pb::cards_service::Service as CardsService; use crate::{ - backend_proto as pb, card::{CardQueue, CardType}, + pb, prelude::*, }; diff --git a/rslib/src/backend/cardrendering.rs b/rslib/src/backend/cardrendering.rs index 3e0de964c..3e4697154 100644 --- a/rslib/src/backend/cardrendering.rs +++ b/rslib/src/backend/cardrendering.rs @@ -2,13 +2,13 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::cardrendering_service::Service as CardRenderingService; +pub(super) use crate::pb::cardrendering_service::Service as CardRenderingService; use crate::{ - backend_proto as pb, card_rendering::{extract_av_tags, strip_av_tags}, latex::{extract_latex, extract_latex_expanding_clozes, ExtractedLatex}, markdown::render_markdown, notetype::{CardTemplateSchema11, RenderCardOutput}, + pb, prelude::*, template::RenderedNode, text::{ diff --git a/rslib/src/backend/collection.rs b/rslib/src/backend/collection.rs index 4832b9445..e1f12c350 100644 --- a/rslib/src/backend/collection.rs +++ b/rslib/src/backend/collection.rs @@ -6,11 +6,11 @@ use std::sync::MutexGuard; use slog::error; use super::{progress::Progress, Backend}; -pub(super) use crate::backend_proto::collection_service::Service as CollectionService; +pub(super) use crate::pb::collection_service::Service as CollectionService; use crate::{ backend::progress::progress_to_proto, - backend_proto::{self as pb}, collection::CollectionBuilder, + pb::{self as pb}, prelude::*, storage::SchemaVersion, }; diff --git a/rslib/src/backend/config.rs b/rslib/src/backend/config.rs index 912db2f0d..9949c66b7 100644 --- a/rslib/src/backend/config.rs +++ b/rslib/src/backend/config.rs @@ -4,11 +4,11 @@ use serde_json::Value; use super::Backend; -pub(super) use crate::backend_proto::config_service::Service as ConfigService; +pub(super) use crate::pb::config_service::Service as ConfigService; use crate::{ - backend_proto as pb, - backend_proto::config_key::{Bool as BoolKeyProto, String as StringKeyProto}, config::{BoolKey, StringKey}, + pb, + pb::config_key::{Bool as BoolKeyProto, String as StringKeyProto}, prelude::*, }; diff --git a/rslib/src/backend/deckconfig.rs b/rslib/src/backend/deckconfig.rs index 53db0ca05..1ebc08231 100644 --- a/rslib/src/backend/deckconfig.rs +++ b/rslib/src/backend/deckconfig.rs @@ -2,10 +2,10 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::deckconfig_service::Service as DeckConfigService; +pub(super) use crate::pb::deckconfig_service::Service as DeckConfigService; use crate::{ - backend_proto as pb, deckconfig::{DeckConfSchema11, DeckConfig, UpdateDeckConfigsRequest}, + pb, prelude::*, }; diff --git a/rslib/src/backend/decks.rs b/rslib/src/backend/decks.rs index 93d9e8695..63cf04743 100644 --- a/rslib/src/backend/decks.rs +++ b/rslib/src/backend/decks.rs @@ -4,10 +4,10 @@ use std::convert::TryFrom; use super::Backend; -pub(super) use crate::backend_proto::decks_service::Service as DecksService; +pub(super) use crate::pb::decks_service::Service as DecksService; use crate::{ - backend_proto::{self as pb}, decks::{DeckSchema11, FilteredSearchOrder}, + pb::{self as pb}, prelude::*, scheduler::filtered::FilteredDeckForUpdate, }; diff --git a/rslib/src/backend/error.rs b/rslib/src/backend/error.rs index 7eba97b34..a385a2ce8 100644 --- a/rslib/src/backend/error.rs +++ b/rslib/src/backend/error.rs @@ -2,9 +2,9 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto as pb, - backend_proto::backend_error::Kind, error::{AnkiError, SyncErrorKind}, + pb, + pb::backend_error::Kind, prelude::*, }; diff --git a/rslib/src/backend/generic.rs b/rslib/src/backend/generic.rs index b86751bcb..85c0c7c0b 100644 --- a/rslib/src/backend/generic.rs +++ b/rslib/src/backend/generic.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, prelude::*}; +use crate::{pb, prelude::*}; impl From> for pb::Json { fn from(json: Vec) -> Self { diff --git a/rslib/src/backend/i18n.rs b/rslib/src/backend/i18n.rs index 66d4a697b..a200766bf 100644 --- a/rslib/src/backend/i18n.rs +++ b/rslib/src/backend/i18n.rs @@ -6,9 +6,9 @@ use std::collections::HashMap; use fluent::{FluentArgs, FluentValue}; use super::Backend; -pub(super) use crate::backend_proto::i18n_service::Service as I18nService; +pub(super) use crate::pb::i18n_service::Service as I18nService; use crate::{ - backend_proto as pb, + pb, prelude::*, scheduler::timespan::{answer_button_time, time_span}, }; diff --git a/rslib/src/backend/import_export.rs b/rslib/src/backend/import_export.rs index ea3c05447..24e29a2ff 100644 --- a/rslib/src/backend/import_export.rs +++ b/rslib/src/backend/import_export.rs @@ -4,10 +4,10 @@ use std::path::Path; use super::{progress::Progress, Backend}; -pub(super) use crate::backend_proto::importexport_service::Service as ImportExportService; +pub(super) use crate::pb::importexport_service::Service as ImportExportService; use crate::{ - backend_proto::{self as pb, export_limit, ExportLimit}, import_export::{package::import_colpkg, ExportProgress, ImportProgress, NoteLog}, + pb::{self as pb, export_limit, ExportLimit}, prelude::*, search::SearchNode, }; diff --git a/rslib/src/backend/links.rs b/rslib/src/backend/links.rs index 76c5bdc98..469b89b07 100644 --- a/rslib/src/backend/links.rs +++ b/rslib/src/backend/links.rs @@ -2,10 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::links_service::Service as LinksService; -use crate::{ - backend_proto as pb, backend_proto::links::help_page_link_request::HelpPage, prelude::*, -}; +pub(super) use crate::pb::links_service::Service as LinksService; +use crate::{pb, pb::links::help_page_link_request::HelpPage, prelude::*}; impl LinksService for Backend { fn help_page_link(&self, input: pb::HelpPageLinkRequest) -> Result { diff --git a/rslib/src/backend/media.rs b/rslib/src/backend/media.rs index 5fb4dad07..1c681d8b7 100644 --- a/rslib/src/backend/media.rs +++ b/rslib/src/backend/media.rs @@ -2,10 +2,10 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::{progress::Progress, Backend}; -pub(super) use crate::backend_proto::media_service::Service as MediaService; +pub(super) use crate::pb::media_service::Service as MediaService; use crate::{ - backend_proto as pb, media::{check::MediaChecker, MediaManager}, + pb, prelude::*, }; diff --git a/rslib/src/backend/mod.rs b/rslib/src/backend/mod.rs index b4ec28cfa..818f8ffed 100644 --- a/rslib/src/backend/mod.rs +++ b/rslib/src/backend/mod.rs @@ -62,11 +62,10 @@ use self::{ }; use crate::{ backend::dbproxy::db_command_bytes, - backend_proto as pb, collection::Collection, error::{AnkiError, Result}, i18n::I18n, - log, + log, pb, }; pub struct Backend { diff --git a/rslib/src/backend/notes.rs b/rslib/src/backend/notes.rs index 360a69a47..2f349f3fd 100644 --- a/rslib/src/backend/notes.rs +++ b/rslib/src/backend/notes.rs @@ -4,10 +4,10 @@ use std::collections::HashSet; use super::Backend; -pub(super) use crate::backend_proto::notes_service::Service as NotesService; +pub(super) use crate::pb::notes_service::Service as NotesService; use crate::{ - backend_proto::{self as pb}, cloze::add_cloze_numbers_in_string, + pb::{self as pb}, prelude::*, }; diff --git a/rslib/src/backend/notetypes.rs b/rslib/src/backend/notetypes.rs index d90759377..dea4fde61 100644 --- a/rslib/src/backend/notetypes.rs +++ b/rslib/src/backend/notetypes.rs @@ -2,13 +2,13 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::notetypes_service::Service as NotetypesService; +pub(super) use crate::pb::notetypes_service::Service as NotetypesService; use crate::{ - backend_proto as pb, config::get_aux_notetype_config_key, notetype::{ all_stock_notetypes, ChangeNotetypeInput, Notetype, NotetypeChangeInfo, NotetypeSchema11, }, + pb, prelude::*, }; diff --git a/rslib/src/backend/ops.rs b/rslib/src/backend/ops.rs index bdefe629d..9e303d9c3 100644 --- a/rslib/src/backend/ops.rs +++ b/rslib/src/backend/ops.rs @@ -2,8 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto as pb, ops::OpChanges, + pb, prelude::*, undo::{UndoOutput, UndoStatus}, }; diff --git a/rslib/src/backend/progress.rs b/rslib/src/backend/progress.rs index 9370b2b01..f9247afaa 100644 --- a/rslib/src/backend/progress.rs +++ b/rslib/src/backend/progress.rs @@ -7,11 +7,11 @@ use futures::future::AbortHandle; use super::Backend; use crate::{ - backend_proto as pb, dbcheck::DatabaseCheckProgress, i18n::I18n, import_export::{ExportProgress, ImportProgress}, media::sync::MediaSyncProgress, + pb, sync::{FullSyncProgress, NormalSyncProgress, SyncStage}, }; diff --git a/rslib/src/backend/scheduler/answering.rs b/rslib/src/backend/scheduler/answering.rs index edb4b013a..3d3447408 100644 --- a/rslib/src/backend/scheduler/answering.rs +++ b/rslib/src/backend/scheduler/answering.rs @@ -2,7 +2,7 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto as pb, + pb, prelude::*, scheduler::{ answering::{CardAnswer, Rating}, diff --git a/rslib/src/backend/scheduler/mod.rs b/rslib/src/backend/scheduler/mod.rs index e3ee09096..e8cfc0730 100644 --- a/rslib/src/backend/scheduler/mod.rs +++ b/rslib/src/backend/scheduler/mod.rs @@ -5,9 +5,9 @@ mod answering; mod states; use super::Backend; -pub(super) use crate::backend_proto::scheduler_service::Service as SchedulerService; +pub(super) use crate::pb::scheduler_service::Service as SchedulerService; use crate::{ - backend_proto as pb, + pb, prelude::*, scheduler::{ new::NewCardDueOrder, diff --git a/rslib/src/backend/scheduler/states/filtered.rs b/rslib/src/backend/scheduler/states/filtered.rs index fabee58bf..48acbe718 100644 --- a/rslib/src/backend/scheduler/states/filtered.rs +++ b/rslib/src/backend/scheduler/states/filtered.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::FilteredState}; +use crate::{pb, scheduler::states::FilteredState}; impl From for pb::scheduling_state::Filtered { fn from(state: FilteredState) -> Self { diff --git a/rslib/src/backend/scheduler/states/learning.rs b/rslib/src/backend/scheduler/states/learning.rs index 55f56e3d1..30b87d8e6 100644 --- a/rslib/src/backend/scheduler/states/learning.rs +++ b/rslib/src/backend/scheduler/states/learning.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::LearnState}; +use crate::{pb, scheduler::states::LearnState}; impl From for LearnState { fn from(state: pb::scheduling_state::Learning) -> Self { diff --git a/rslib/src/backend/scheduler/states/mod.rs b/rslib/src/backend/scheduler/states/mod.rs index f82865aba..d21421fba 100644 --- a/rslib/src/backend/scheduler/states/mod.rs +++ b/rslib/src/backend/scheduler/states/mod.rs @@ -11,7 +11,7 @@ mod rescheduling; mod review; use crate::{ - backend_proto as pb, + pb, scheduler::states::{CardState, NewState, NextCardStates, NormalState}, }; diff --git a/rslib/src/backend/scheduler/states/new.rs b/rslib/src/backend/scheduler/states/new.rs index 2faf20ae1..ca508a49a 100644 --- a/rslib/src/backend/scheduler/states/new.rs +++ b/rslib/src/backend/scheduler/states/new.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::NewState}; +use crate::{pb, scheduler::states::NewState}; impl From for NewState { fn from(state: pb::scheduling_state::New) -> Self { diff --git a/rslib/src/backend/scheduler/states/normal.rs b/rslib/src/backend/scheduler/states/normal.rs index f332bc117..d3d96db2e 100644 --- a/rslib/src/backend/scheduler/states/normal.rs +++ b/rslib/src/backend/scheduler/states/normal.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::NormalState}; +use crate::{pb, scheduler::states::NormalState}; impl From for pb::scheduling_state::Normal { fn from(state: NormalState) -> Self { diff --git a/rslib/src/backend/scheduler/states/preview.rs b/rslib/src/backend/scheduler/states/preview.rs index 24d3c2877..d696b908f 100644 --- a/rslib/src/backend/scheduler/states/preview.rs +++ b/rslib/src/backend/scheduler/states/preview.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::PreviewState}; +use crate::{pb, scheduler::states::PreviewState}; impl From for PreviewState { fn from(state: pb::scheduling_state::Preview) -> Self { diff --git a/rslib/src/backend/scheduler/states/relearning.rs b/rslib/src/backend/scheduler/states/relearning.rs index 205033c50..6a77c7f6f 100644 --- a/rslib/src/backend/scheduler/states/relearning.rs +++ b/rslib/src/backend/scheduler/states/relearning.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::RelearnState}; +use crate::{pb, scheduler::states::RelearnState}; impl From for RelearnState { fn from(state: pb::scheduling_state::Relearning) -> Self { diff --git a/rslib/src/backend/scheduler/states/rescheduling.rs b/rslib/src/backend/scheduler/states/rescheduling.rs index d32e8a137..c23d3b512 100644 --- a/rslib/src/backend/scheduler/states/rescheduling.rs +++ b/rslib/src/backend/scheduler/states/rescheduling.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::ReschedulingFilterState}; +use crate::{pb, scheduler::states::ReschedulingFilterState}; impl From for ReschedulingFilterState { fn from(state: pb::scheduling_state::ReschedulingFilter) -> Self { diff --git a/rslib/src/backend/scheduler/states/review.rs b/rslib/src/backend/scheduler/states/review.rs index ec047bd87..dce2f1246 100644 --- a/rslib/src/backend/scheduler/states/review.rs +++ b/rslib/src/backend/scheduler/states/review.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, scheduler::states::ReviewState}; +use crate::{pb, scheduler::states::ReviewState}; impl From for ReviewState { fn from(state: pb::scheduling_state::Review) -> Self { diff --git a/rslib/src/backend/search/browser_table.rs b/rslib/src/backend/search/browser_table.rs index 6a8e70f92..fa8f6462d 100644 --- a/rslib/src/backend/search/browser_table.rs +++ b/rslib/src/backend/search/browser_table.rs @@ -3,7 +3,7 @@ use std::str::FromStr; -use crate::{backend_proto as pb, browser_table, i18n::I18n}; +use crate::{browser_table, i18n::I18n, pb}; impl browser_table::Column { pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column { diff --git a/rslib/src/backend/search/mod.rs b/rslib/src/backend/search/mod.rs index 66b0fe406..98075662c 100644 --- a/rslib/src/backend/search/mod.rs +++ b/rslib/src/backend/search/mod.rs @@ -7,11 +7,11 @@ mod search_node; use std::{str::FromStr, sync::Arc}; use super::{notes::to_note_ids, Backend}; -pub(super) use crate::backend_proto::search_service::Service as SearchService; +pub(super) use crate::pb::search_service::Service as SearchService; use crate::{ - backend_proto as pb, - backend_proto::sort_order::Value as SortOrderProto, browser_table::Column, + pb, + pb::sort_order::Value as SortOrderProto, prelude::*, search::{replace_search_node, JoinSearches, Node, SortMode}, }; diff --git a/rslib/src/backend/search/search_node.rs b/rslib/src/backend/search/search_node.rs index 8df1477e7..0354fb17d 100644 --- a/rslib/src/backend/search/search_node.rs +++ b/rslib/src/backend/search/search_node.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use crate::{ - backend_proto as pb, + pb, prelude::*, search::{ parse_search, Negated, Node, PropertyKind, RatingKind, SearchNode, StateKind, TemplateKind, diff --git a/rslib/src/backend/stats.rs b/rslib/src/backend/stats.rs index 6bb2a50b6..adaef28e9 100644 --- a/rslib/src/backend/stats.rs +++ b/rslib/src/backend/stats.rs @@ -2,8 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::Backend; -pub(super) use crate::backend_proto::stats_service::Service as StatsService; -use crate::{backend_proto as pb, prelude::*, revlog::RevlogReviewKind}; +pub(super) use crate::pb::stats_service::Service as StatsService; +use crate::{pb, prelude::*, revlog::RevlogReviewKind}; impl StatsService for Backend { fn card_stats(&self, input: pb::CardId) -> Result { diff --git a/rslib/src/backend/sync/mod.rs b/rslib/src/backend/sync/mod.rs index 7c63e1eb5..df98606eb 100644 --- a/rslib/src/backend/sync/mod.rs +++ b/rslib/src/backend/sync/mod.rs @@ -9,10 +9,10 @@ use futures::future::{AbortHandle, AbortRegistration, Abortable}; use slog::warn; use super::{progress::AbortHandleSlot, Backend}; -pub(super) use crate::backend_proto::sync_service::Service as SyncService; +pub(super) use crate::pb::sync_service::Service as SyncService; use crate::{ - backend_proto as pb, media::MediaManager, + pb, prelude::*, sync::{ get_remote_sync_meta, http::SyncRequest, sync_abort, sync_login, FullSyncProgress, diff --git a/rslib/src/backend/tags.rs b/rslib/src/backend/tags.rs index 5601efcc4..9f19b1737 100644 --- a/rslib/src/backend/tags.rs +++ b/rslib/src/backend/tags.rs @@ -2,8 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::{notes::to_note_ids, Backend}; -pub(super) use crate::backend_proto::tags_service::Service as TagsService; -use crate::{backend_proto as pb, prelude::*}; +pub(super) use crate::pb::tags_service::Service as TagsService; +use crate::{pb, prelude::*}; impl TagsService for Backend { fn clear_unused_tags(&self, _input: pb::Empty) -> Result { diff --git a/rslib/src/browser_table.rs b/rslib/src/browser_table.rs index 83d5a0366..28b83fa76 100644 --- a/rslib/src/browser_table.rs +++ b/rslib/src/browser_table.rs @@ -7,10 +7,10 @@ use itertools::Itertools; use strum::{Display, EnumIter, EnumString, IntoEnumIterator}; use crate::{ - backend_proto as pb, card::{CardQueue, CardType}, card_rendering::prettify_av_tags, notetype::{CardTemplate, NotetypeKind}, + pb, prelude::*, scheduler::{timespan::time_span, timing::SchedTimingToday}, template::RenderedNode, diff --git a/rslib/src/card_rendering/mod.rs b/rslib/src/card_rendering/mod.rs index bfb4c5ff4..628ea7d17 100644 --- a/rslib/src/card_rendering/mod.rs +++ b/rslib/src/card_rendering/mod.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; -use crate::{backend_proto as pb, prelude::*}; +use crate::{pb, prelude::*}; mod parser; mod writer; diff --git a/rslib/src/card_rendering/writer.rs b/rslib/src/card_rendering/writer.rs index b1e9f97cd..0fc6d3112 100644 --- a/rslib/src/card_rendering/writer.rs +++ b/rslib/src/card_rendering/writer.rs @@ -5,7 +5,7 @@ use std::fmt::Write as _; use super::{CardNodes, Directive, Node, OtherDirective, TtsDirective}; use crate::{ - backend_proto as pb, + pb, prelude::*, text::{decode_entities, strip_html_for_tts}, }; diff --git a/rslib/src/collection/backup.rs b/rslib/src/collection/backup.rs index 1f5806558..5ec1b148f 100644 --- a/rslib/src/collection/backup.rs +++ b/rslib/src/collection/backup.rs @@ -14,8 +14,7 @@ use itertools::Itertools; use log::error; use crate::{ - backend_proto::preferences::BackupLimits, import_export::package::export_colpkg_from_data, log, - prelude::*, + import_export::package::export_colpkg_from_data, log, pb::preferences::BackupLimits, prelude::*, }; const BACKUP_FORMAT_STRING: &str = "backup-%Y-%m-%d-%H.%M.%S.colpkg"; diff --git a/rslib/src/config/mod.rs b/rslib/src/config/mod.rs index 1e7f0408a..137437615 100644 --- a/rslib/src/config/mod.rs +++ b/rslib/src/config/mod.rs @@ -18,7 +18,7 @@ pub use self::{ bool::BoolKey, deck::DeckConfigKey, notetype::get_aux_notetype_config_key, number::I32ConfigKey, string::StringKey, }; -use crate::{backend_proto::preferences::BackupLimits, prelude::*}; +use crate::{pb::preferences::BackupLimits, prelude::*}; /// Only used when updating/undoing. #[derive(Debug)] diff --git a/rslib/src/deckconfig/mod.rs b/rslib/src/deckconfig/mod.rs index f25e5c265..fca8a38f9 100644 --- a/rslib/src/deckconfig/mod.rs +++ b/rslib/src/deckconfig/mod.rs @@ -8,7 +8,7 @@ mod update; pub use schema11::{DeckConfSchema11, NewCardOrderSchema11}; pub use update::UpdateDeckConfigsRequest; -pub use crate::backend_proto::deck_config::{ +pub use crate::pb::deck_config::{ config::{ LeechAction, NewCardGatherPriority, NewCardInsertOrder, NewCardSortOrder, ReviewCardOrder, ReviewMix, diff --git a/rslib/src/deckconfig/update.rs b/rslib/src/deckconfig/update.rs index 3007046b3..3b464d3f9 100644 --- a/rslib/src/deckconfig/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -9,9 +9,9 @@ use std::{ }; use crate::{ - backend_proto as pb, - backend_proto::deck_configs_for_update::{ConfigWithExtra, CurrentDeck}, config::StringKey, + pb, + pb::deck_configs_for_update::{ConfigWithExtra, CurrentDeck}, prelude::*, }; diff --git a/rslib/src/decks/counts.rs b/rslib/src/decks/counts.rs index 1d86805dd..d1c780aa4 100644 --- a/rslib/src/decks/counts.rs +++ b/rslib/src/decks/counts.rs @@ -2,7 +2,7 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use std::collections::HashMap; -use crate::{backend_proto as pb, prelude::*}; +use crate::{pb, prelude::*}; #[derive(Debug)] pub(crate) struct DueCounts { diff --git a/rslib/src/decks/mod.rs b/rslib/src/decks/mod.rs index f6b8553cd..64a43a881 100644 --- a/rslib/src/decks/mod.rs +++ b/rslib/src/decks/mod.rs @@ -21,7 +21,7 @@ pub(crate) use name::immediate_parent_name; pub use name::NativeDeckName; pub use schema11::DeckSchema11; -pub use crate::backend_proto::{ +pub use crate::pb::{ deck::{ filtered::{search_term::Order as FilteredSearchOrder, SearchTerm as FilteredSearchTerm}, kind_container::Kind as DeckKind, diff --git a/rslib/src/decks/stats.rs b/rslib/src/decks/stats.rs index a54626577..3375b93d9 100644 --- a/rslib/src/decks/stats.rs +++ b/rslib/src/decks/stats.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use super::DeckCommon; -use crate::{backend_proto as pb, prelude::*}; +use crate::{pb, prelude::*}; impl Deck { pub(super) fn reset_stats_if_day_changed(&mut self, today: u32) { diff --git a/rslib/src/decks/tree.rs b/rslib/src/decks/tree.rs index e96da4267..31ea2581d 100644 --- a/rslib/src/decks/tree.rs +++ b/rslib/src/decks/tree.rs @@ -14,10 +14,8 @@ use super::{ limits::{remaining_limits_map, RemainingLimits}, DueCounts, }; -pub use crate::backend_proto::set_deck_collapsed_request::Scope as DeckCollapseScope; -use crate::{ - backend_proto::DeckTreeNode, config::SchedulerVersion, ops::OpOutput, prelude::*, undo::Op, -}; +pub use crate::pb::set_deck_collapsed_request::Scope as DeckCollapseScope; +use crate::{config::SchedulerVersion, ops::OpOutput, pb::DeckTreeNode, prelude::*, undo::Op}; fn deck_names_to_tree(names: impl Iterator) -> DeckTreeNode { let mut top = DeckTreeNode::default(); diff --git a/rslib/src/import_export/mod.rs b/rslib/src/import_export/mod.rs index 865fbbd6a..1a80f9c46 100644 --- a/rslib/src/import_export/mod.rs +++ b/rslib/src/import_export/mod.rs @@ -8,7 +8,7 @@ pub mod text; use std::marker::PhantomData; -pub use crate::backend_proto::import_response::{Log as NoteLog, Note as LogNote}; +pub use crate::pb::import_response::{Log as NoteLog, Note as LogNote}; use crate::{ prelude::*, text::{ diff --git a/rslib/src/import_export/package/meta.rs b/rslib/src/import_export/package/meta.rs index 62e8dbda4..0746fa389 100644 --- a/rslib/src/import_export/package/meta.rs +++ b/rslib/src/import_export/package/meta.rs @@ -6,7 +6,7 @@ use std::{fs::File, io::Read}; use prost::Message; use zip::ZipArchive; -pub(super) use crate::backend_proto::{package_metadata::Version, PackageMetadata as Meta}; +pub(super) use crate::pb::{package_metadata::Version, PackageMetadata as Meta}; use crate::{error::ImportError, prelude::*, storage::SchemaVersion}; impl Version { diff --git a/rslib/src/import_export/package/mod.rs b/rslib/src/import_export/package/mod.rs index 70b8bfb14..244dca986 100644 --- a/rslib/src/import_export/package/mod.rs +++ b/rslib/src/import_export/package/mod.rs @@ -11,4 +11,4 @@ pub(crate) use colpkg::export::export_colpkg_from_data; pub use colpkg::import::import_colpkg; pub(self) use meta::{Meta, Version}; -pub(self) use crate::backend_proto::{media_entries::MediaEntry, MediaEntries}; +pub(self) use crate::pb::{media_entries::MediaEntry, MediaEntries}; diff --git a/rslib/src/import_export/text/csv/export.rs b/rslib/src/import_export/text/csv/export.rs index 6d9072b91..dc44e96ce 100644 --- a/rslib/src/import_export/text/csv/export.rs +++ b/rslib/src/import_export/text/csv/export.rs @@ -9,9 +9,9 @@ use regex::Regex; use super::metadata::Delimiter; use crate::{ - backend_proto::ExportNoteCsvRequest, import_export::{ExportProgress, IncrementableProgress}, notetype::RenderCardOutput, + pb::ExportNoteCsvRequest, prelude::*, search::{SearchNode, SortMode}, template::RenderedNode, diff --git a/rslib/src/import_export/text/csv/import.rs b/rslib/src/import_export/text/csv/import.rs index 7290db031..f355ca0ff 100644 --- a/rslib/src/import_export/text/csv/import.rs +++ b/rslib/src/import_export/text/csv/import.rs @@ -239,7 +239,7 @@ mod test { use std::io::Cursor; use super::*; - use crate::backend_proto::import_export::csv_metadata::MappedNotetype; + use crate::pb::import_export::csv_metadata::MappedNotetype; macro_rules! import { ($metadata:expr, $csv:expr) => {{ diff --git a/rslib/src/import_export/text/csv/metadata.rs b/rslib/src/import_export/text/csv/metadata.rs index b77a045cd..e2cb17f88 100644 --- a/rslib/src/import_export/text/csv/metadata.rs +++ b/rslib/src/import_export/text/csv/metadata.rs @@ -11,17 +11,17 @@ use itertools::Itertools; use strum::IntoEnumIterator; use super::import::build_csv_reader; -pub use crate::backend_proto::import_export::{ +pub use crate::pb::import_export::{ csv_metadata::{Deck as CsvDeck, Delimiter, MappedNotetype, Notetype as CsvNotetype}, import_csv_request::DupeResolution, CsvMetadata, }; use crate::{ - backend_proto::StringList, config::I32ConfigKey, error::ImportError, import_export::text::NameOrId, notetype::NoteField, + pb::StringList, prelude::*, text::{html_to_text_line, is_html}, }; diff --git a/rslib/src/import_export/text/mod.rs b/rslib/src/import_export/text/mod.rs index ff128076b..e81cbae45 100644 --- a/rslib/src/import_export/text/mod.rs +++ b/rslib/src/import_export/text/mod.rs @@ -8,7 +8,7 @@ mod json; use serde_derive::{Deserialize, Serialize}; use super::LogNote; -use crate::backend_proto::import_csv_request::DupeResolution; +use crate::pb::import_csv_request::DupeResolution; #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(default)] diff --git a/rslib/src/lib.rs b/rslib/src/lib.rs index dc43db87e..134d1dfc8 100644 --- a/rslib/src/lib.rs +++ b/rslib/src/lib.rs @@ -5,7 +5,6 @@ pub mod adding; pub mod backend; -mod backend_proto; pub mod browser_table; pub mod card; pub mod card_rendering; @@ -28,6 +27,7 @@ pub mod media; pub mod notes; pub mod notetype; pub mod ops; +pub mod pb; mod preferences; pub mod prelude; pub mod revlog; diff --git a/rslib/src/links.rs b/rslib/src/links.rs index 670dc0178..f4e2d1cd6 100644 --- a/rslib/src/links.rs +++ b/rslib/src/links.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -pub use crate::backend_proto::links::help_page_link_request::HelpPage; +pub use crate::pb::links::help_page_link_request::HelpPage; static HELP_SITE: &str = "https://docs.ankiweb.net/"; diff --git a/rslib/src/notes/mod.rs b/rslib/src/notes/mod.rs index 6a375f6ad..f6a1b726b 100644 --- a/rslib/src/notes/mod.rs +++ b/rslib/src/notes/mod.rs @@ -12,14 +12,14 @@ use itertools::Itertools; use num_integer::Integer; use crate::{ - backend_proto as pb, - backend_proto::note_fields_check_response::State as NoteFieldsState, cloze::contains_cloze, decks::DeckId, define_newtype, error::{AnkiError, Result}, notetype::{CardGenContext, NoteField, Notetype, NotetypeId}, ops::StateChanges, + pb, + pb::note_fields_check_response::State as NoteFieldsState, prelude::*, template::field_is_empty, text::{ensure_string_in_nfc, normalize_to_nfc, strip_html_preserving_media_filenames}, diff --git a/rslib/src/notetype/fields.rs b/rslib/src/notetype/fields.rs index 866afb0e1..1b126f0cf 100644 --- a/rslib/src/notetype/fields.rs +++ b/rslib/src/notetype/fields.rs @@ -3,8 +3,8 @@ use super::{NoteFieldConfig, NoteFieldProto}; use crate::{ - backend_proto::UInt32, error::{AnkiError, Result}, + pb::UInt32, }; #[derive(Debug, PartialEq, Clone)] diff --git a/rslib/src/notetype/mod.rs b/rslib/src/notetype/mod.rs index c8e5922a1..419ecb78f 100644 --- a/rslib/src/notetype/mod.rs +++ b/rslib/src/notetype/mod.rs @@ -29,7 +29,7 @@ pub use stock::all_stock_notetypes; pub use templates::CardTemplate; use unicase::UniCase; -pub use crate::backend_proto::{ +pub use crate::pb::{ notetype::{ config::{ card_requirement::Kind as CardRequirementKind, CardRequirement, Kind as NotetypeKind, diff --git a/rslib/src/notetype/stock.rs b/rslib/src/notetype/stock.rs index 32935a546..c44c5b3d2 100644 --- a/rslib/src/notetype/stock.rs +++ b/rslib/src/notetype/stock.rs @@ -3,11 +3,11 @@ use super::NotetypeConfig; use crate::{ - backend_proto::stock_notetype::Kind, config::{ConfigEntry, ConfigKey}, error::Result, i18n::I18n, notetype::Notetype, + pb::stock_notetype::Kind, storage::SqliteStorage, timestamp::TimestampSecs, }; diff --git a/rslib/src/notetype/templates.rs b/rslib/src/notetype/templates.rs index b9ac062fc..0b8b544fb 100644 --- a/rslib/src/notetype/templates.rs +++ b/rslib/src/notetype/templates.rs @@ -3,9 +3,9 @@ use super::{CardTemplateConfig, CardTemplateProto}; use crate::{ - backend_proto::UInt32, decks::DeckId, error::{AnkiError, Result}, + pb::UInt32, template::ParsedTemplate, timestamp::TimestampSecs, types::Usn, diff --git a/rslib/src/backend_proto.rs b/rslib/src/pb.rs similarity index 100% rename from rslib/src/backend_proto.rs rename to rslib/src/pb.rs diff --git a/rslib/src/preferences.rs b/rslib/src/preferences.rs index 2a7572350..4c9905ba3 100644 --- a/rslib/src/preferences.rs +++ b/rslib/src/preferences.rs @@ -2,13 +2,13 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto::{ - preferences::{scheduling::NewReviewMix as NewRevMixPB, Editing, Reviewing, Scheduling}, - Preferences, - }, collection::Collection, config::{BoolKey, StringKey}, error::Result, + pb::{ + preferences::{scheduling::NewReviewMix as NewRevMixPB, Editing, Reviewing, Scheduling}, + Preferences, + }, prelude::*, scheduler::timing::local_minutes_west_for_stamp, }; diff --git a/rslib/src/scheduler/answering/mod.rs b/rslib/src/scheduler/answering/mod.rs index 6bc229c36..861fcba1d 100644 --- a/rslib/src/scheduler/answering/mod.rs +++ b/rslib/src/scheduler/answering/mod.rs @@ -19,10 +19,10 @@ use super::{ timing::SchedTimingToday, }; use crate::{ - backend_proto, card::CardQueue, deckconfig::{DeckConfig, LeechAction}, decks::Deck, + pb, prelude::*, }; @@ -329,7 +329,7 @@ impl Collection { self.update_deck_stats( updater.timing.days_elapsed, usn, - backend_proto::UpdateStatsRequest { + pb::UpdateStatsRequest { deck_id: updater.deck.id.0, new_delta, review_delta, diff --git a/rslib/src/scheduler/bury_and_suspend.rs b/rslib/src/scheduler/bury_and_suspend.rs index c3607d9c2..5e746b1fe 100644 --- a/rslib/src/scheduler/bury_and_suspend.rs +++ b/rslib/src/scheduler/bury_and_suspend.rs @@ -3,12 +3,12 @@ use super::timing::SchedTimingToday; use crate::{ - backend_proto::{ + card::CardQueue, + config::SchedulerVersion, + pb::{ bury_or_suspend_cards_request::Mode as BuryOrSuspendMode, unbury_deck_request::Mode as UnburyDeckMode, }, - card::CardQueue, - config::SchedulerVersion, prelude::*, search::{JoinSearches, SearchNode, SortMode, StateKind}, }; diff --git a/rslib/src/scheduler/congrats.rs b/rslib/src/scheduler/congrats.rs index 364344ddd..6a95cd56f 100644 --- a/rslib/src/scheduler/congrats.rs +++ b/rslib/src/scheduler/congrats.rs @@ -1,7 +1,7 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -use crate::{backend_proto as pb, prelude::*}; +use crate::{pb, prelude::*}; #[derive(Debug)] pub(crate) struct CongratsInfo { @@ -51,7 +51,7 @@ mod test { let info = col.congrats_info().unwrap(); assert_eq!( info, - crate::backend_proto::CongratsInfoResponse { + crate::pb::CongratsInfoResponse { learn_remaining: 0, review_remaining: false, new_remaining: false, diff --git a/rslib/src/scheduler/filtered/custom_study.rs b/rslib/src/scheduler/filtered/custom_study.rs index 73f368a6b..8dbf6a0bd 100644 --- a/rslib/src/scheduler/filtered/custom_study.rs +++ b/rslib/src/scheduler/filtered/custom_study.rs @@ -5,13 +5,13 @@ use std::collections::HashSet; use super::FilteredDeckForUpdate; use crate::{ - backend_proto::{ - self as pb, - custom_study_request::{cram::CramKind, Cram, Value as CustomStudyValue}, - }, config::DeckConfigKey, decks::{FilteredDeck, FilteredSearchOrder, FilteredSearchTerm}, error::{CustomStudyError, FilteredDeckError}, + pb::{ + self as pb, + custom_study_request::{cram::CramKind, Cram, Value as CustomStudyValue}, + }, prelude::*, search::{JoinSearches, Negated, PropertyKind, RatingKind, SearchNode, StateKind}, }; @@ -293,11 +293,11 @@ fn tags_to_nodes(tags_to_include: &[String], tags_to_exclude: &[String]) -> Sear mod test { use super::*; use crate::{ - backend_proto::{ + collection::open_test_collection, + pb::{ scheduler::custom_study_request::{cram::CramKind, Cram, Value}, CustomStudyRequest, }, - collection::open_test_collection, }; #[test] diff --git a/rslib/src/scheduler/new.rs b/rslib/src/scheduler/new.rs index 421e6fb5b..734ec49ef 100644 --- a/rslib/src/scheduler/new.rs +++ b/rslib/src/scheduler/new.rs @@ -5,7 +5,7 @@ use std::collections::{HashMap, HashSet}; use rand::seq::SliceRandom; -pub use crate::backend_proto::scheduler::{ +pub use crate::pb::scheduler::{ schedule_cards_as_new_request::Context as ScheduleAsNewContext, ScheduleCardsAsNewDefaultsResponse, }; diff --git a/rslib/src/scheduler/queue/builder/mod.rs b/rslib/src/scheduler/queue/builder/mod.rs index dd0045ba4..7f553af76 100644 --- a/rslib/src/scheduler/queue/builder/mod.rs +++ b/rslib/src/scheduler/queue/builder/mod.rs @@ -264,9 +264,9 @@ impl Collection { mod test { use super::*; use crate::{ - backend_proto::deck_config::config::{NewCardGatherPriority, NewCardSortOrder}, card::{CardQueue, CardType}, collection::open_test_collection, + pb::deck_config::config::{NewCardGatherPriority, NewCardSortOrder}, }; impl Collection { diff --git a/rslib/src/stats/card.rs b/rslib/src/stats/card.rs index fd5133695..9aae46e45 100644 --- a/rslib/src/stats/card.rs +++ b/rslib/src/stats/card.rs @@ -2,8 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto as pb, card::{CardQueue, CardType}, + pb, prelude::*, revlog::RevlogEntry, }; diff --git a/rslib/src/stats/graphs.rs b/rslib/src/stats/graphs.rs index eb5236e66..0fb7d7a86 100644 --- a/rslib/src/stats/graphs.rs +++ b/rslib/src/stats/graphs.rs @@ -2,8 +2,8 @@ // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html use crate::{ - backend_proto as pb, config::{BoolKey, Weekday}, + pb, prelude::*, revlog::RevlogEntry, search::SortMode, diff --git a/rslib/src/storage/revlog/mod.rs b/rslib/src/storage/revlog/mod.rs index d18d321e4..cceee4eb4 100644 --- a/rslib/src/storage/revlog/mod.rs +++ b/rslib/src/storage/revlog/mod.rs @@ -11,8 +11,8 @@ use rusqlite::{ use super::SqliteStorage; use crate::{ - backend_proto as pb, error::Result, + pb, prelude::*, revlog::{RevlogEntry, RevlogReviewKind}, }; diff --git a/rslib/src/sync/http.rs b/rslib/src/sync/http.rs index 4e5954e62..665d61abf 100644 --- a/rslib/src/sync/http.rs +++ b/rslib/src/sync/http.rs @@ -6,7 +6,7 @@ use std::{fs, path::PathBuf}; use serde::{Deserialize, Serialize}; use super::{Chunk, Graves, SanityCheckCounts, UnchunkedChanges}; -use crate::{backend_proto::sync_server_method_request::Method, prelude::*}; +use crate::{pb::sync_server_method_request::Method, prelude::*}; #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub enum SyncRequest { diff --git a/rslib/src/sync/mod.rs b/rslib/src/sync/mod.rs index 538790a0c..eb3c43d6c 100644 --- a/rslib/src/sync/mod.rs +++ b/rslib/src/sync/mod.rs @@ -16,7 +16,6 @@ use serde_tuple::Serialize_tuple; pub(crate) use server::{LocalServer, SyncServer}; use crate::{ - backend_proto::{sync_status_response, SyncStatusResponse}, card::{Card, CardQueue, CardType}, deckconfig::DeckConfSchema11, decks::DeckSchema11, @@ -24,6 +23,7 @@ use crate::{ io::atomic_rename, notes::Note, notetype::{Notetype, NotetypeSchema11}, + pb::{sync_status_response, SyncStatusResponse}, prelude::*, revlog::RevlogEntry, serde::{default_on_invalid, deserialize_int_from_number}, diff --git a/rslib/src/tags/tree.rs b/rslib/src/tags/tree.rs index a4e4ff9fa..20bccbf9a 100644 --- a/rslib/src/tags/tree.rs +++ b/rslib/src/tags/tree.rs @@ -6,7 +6,7 @@ use std::{collections::HashSet, iter::Peekable}; use unicase::UniCase; use super::{immediate_parent_name_unicase, Tag}; -use crate::{backend_proto::TagTreeNode, prelude::*}; +use crate::{pb::TagTreeNode, prelude::*}; impl Collection { pub fn tag_tree(&mut self) -> Result {