Expose backend_proto publicly for AnkiDroid, and rename to pb

We were aliasing it on import half the time anyway
This commit is contained in:
Damien Elmes 2022-06-27 15:03:38 +10:00
parent 6ff159304d
commit 67e4edcd8b
74 changed files with 109 additions and 115 deletions

View File

@ -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::{adding::DeckAndNotetype, backend_proto::DeckAndNotetype as DeckAndNotetypeProto}; use crate::{adding::DeckAndNotetype, pb::DeckAndNotetype as DeckAndNotetypeProto};
impl From<DeckAndNotetype> for DeckAndNotetypeProto { impl From<DeckAndNotetype> for DeckAndNotetypeProto {
fn from(s: DeckAndNotetype) -> Self { fn from(s: DeckAndNotetype) -> Self {

View File

@ -2,10 +2,10 @@
// 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::Backend; 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::{ use crate::{
backend_proto as pb,
card::{CardQueue, CardType}, card::{CardQueue, CardType},
pb,
prelude::*, prelude::*,
}; };

View File

@ -2,13 +2,13 @@
// 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::Backend; 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::{ use crate::{
backend_proto as pb,
card_rendering::{extract_av_tags, strip_av_tags}, card_rendering::{extract_av_tags, strip_av_tags},
latex::{extract_latex, extract_latex_expanding_clozes, ExtractedLatex}, latex::{extract_latex, extract_latex_expanding_clozes, ExtractedLatex},
markdown::render_markdown, markdown::render_markdown,
notetype::{CardTemplateSchema11, RenderCardOutput}, notetype::{CardTemplateSchema11, RenderCardOutput},
pb,
prelude::*, prelude::*,
template::RenderedNode, template::RenderedNode,
text::{ text::{

View File

@ -6,11 +6,11 @@ use std::sync::MutexGuard;
use slog::error; use slog::error;
use super::{progress::Progress, Backend}; 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::{ use crate::{
backend::progress::progress_to_proto, backend::progress::progress_to_proto,
backend_proto::{self as pb},
collection::CollectionBuilder, collection::CollectionBuilder,
pb::{self as pb},
prelude::*, prelude::*,
storage::SchemaVersion, storage::SchemaVersion,
}; };

View File

@ -4,11 +4,11 @@
use serde_json::Value; use serde_json::Value;
use super::Backend; 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::{ use crate::{
backend_proto as pb,
backend_proto::config_key::{Bool as BoolKeyProto, String as StringKeyProto},
config::{BoolKey, StringKey}, config::{BoolKey, StringKey},
pb,
pb::config_key::{Bool as BoolKeyProto, String as StringKeyProto},
prelude::*, prelude::*,
}; };

View File

@ -2,10 +2,10 @@
// 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::Backend; 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::{ use crate::{
backend_proto as pb,
deckconfig::{DeckConfSchema11, DeckConfig, UpdateDeckConfigsRequest}, deckconfig::{DeckConfSchema11, DeckConfig, UpdateDeckConfigsRequest},
pb,
prelude::*, prelude::*,
}; };

View File

@ -4,10 +4,10 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use super::Backend; 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::{ use crate::{
backend_proto::{self as pb},
decks::{DeckSchema11, FilteredSearchOrder}, decks::{DeckSchema11, FilteredSearchOrder},
pb::{self as pb},
prelude::*, prelude::*,
scheduler::filtered::FilteredDeckForUpdate, scheduler::filtered::FilteredDeckForUpdate,
}; };

View File

@ -2,9 +2,9 @@
// 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::{ use crate::{
backend_proto as pb,
backend_proto::backend_error::Kind,
error::{AnkiError, SyncErrorKind}, error::{AnkiError, SyncErrorKind},
pb,
pb::backend_error::Kind,
prelude::*, prelude::*,
}; };

View File

@ -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::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
impl From<Vec<u8>> for pb::Json { impl From<Vec<u8>> for pb::Json {
fn from(json: Vec<u8>) -> Self { fn from(json: Vec<u8>) -> Self {

View File

@ -6,9 +6,9 @@ use std::collections::HashMap;
use fluent::{FluentArgs, FluentValue}; use fluent::{FluentArgs, FluentValue};
use super::Backend; 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::{ use crate::{
backend_proto as pb, pb,
prelude::*, prelude::*,
scheduler::timespan::{answer_button_time, time_span}, scheduler::timespan::{answer_button_time, time_span},
}; };

View File

@ -4,10 +4,10 @@
use std::path::Path; use std::path::Path;
use super::{progress::Progress, Backend}; 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::{ use crate::{
backend_proto::{self as pb, export_limit, ExportLimit},
import_export::{package::import_colpkg, ExportProgress, ImportProgress, NoteLog}, import_export::{package::import_colpkg, ExportProgress, ImportProgress, NoteLog},
pb::{self as pb, export_limit, ExportLimit},
prelude::*, prelude::*,
search::SearchNode, search::SearchNode,
}; };

View File

@ -2,10 +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 super::Backend; use super::Backend;
pub(super) use crate::backend_proto::links_service::Service as LinksService; pub(super) use crate::pb::links_service::Service as LinksService;
use crate::{ use crate::{pb, pb::links::help_page_link_request::HelpPage, prelude::*};
backend_proto as pb, backend_proto::links::help_page_link_request::HelpPage, prelude::*,
};
impl LinksService for Backend { impl LinksService for Backend {
fn help_page_link(&self, input: pb::HelpPageLinkRequest) -> Result<pb::String> { fn help_page_link(&self, input: pb::HelpPageLinkRequest) -> Result<pb::String> {

View File

@ -2,10 +2,10 @@
// 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::{progress::Progress, Backend}; 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::{ use crate::{
backend_proto as pb,
media::{check::MediaChecker, MediaManager}, media::{check::MediaChecker, MediaManager},
pb,
prelude::*, prelude::*,
}; };

View File

@ -62,11 +62,10 @@ use self::{
}; };
use crate::{ use crate::{
backend::dbproxy::db_command_bytes, backend::dbproxy::db_command_bytes,
backend_proto as pb,
collection::Collection, collection::Collection,
error::{AnkiError, Result}, error::{AnkiError, Result},
i18n::I18n, i18n::I18n,
log, log, pb,
}; };
pub struct Backend { pub struct Backend {

View File

@ -4,10 +4,10 @@
use std::collections::HashSet; use std::collections::HashSet;
use super::Backend; 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::{ use crate::{
backend_proto::{self as pb},
cloze::add_cloze_numbers_in_string, cloze::add_cloze_numbers_in_string,
pb::{self as pb},
prelude::*, prelude::*,
}; };

View File

@ -2,13 +2,13 @@
// 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::Backend; 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::{ use crate::{
backend_proto as pb,
config::get_aux_notetype_config_key, config::get_aux_notetype_config_key,
notetype::{ notetype::{
all_stock_notetypes, ChangeNotetypeInput, Notetype, NotetypeChangeInfo, NotetypeSchema11, all_stock_notetypes, ChangeNotetypeInput, Notetype, NotetypeChangeInfo, NotetypeSchema11,
}, },
pb,
prelude::*, prelude::*,
}; };

View File

@ -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::{ use crate::{
backend_proto as pb,
ops::OpChanges, ops::OpChanges,
pb,
prelude::*, prelude::*,
undo::{UndoOutput, UndoStatus}, undo::{UndoOutput, UndoStatus},
}; };

View File

@ -7,11 +7,11 @@ use futures::future::AbortHandle;
use super::Backend; use super::Backend;
use crate::{ use crate::{
backend_proto as pb,
dbcheck::DatabaseCheckProgress, dbcheck::DatabaseCheckProgress,
i18n::I18n, i18n::I18n,
import_export::{ExportProgress, ImportProgress}, import_export::{ExportProgress, ImportProgress},
media::sync::MediaSyncProgress, media::sync::MediaSyncProgress,
pb,
sync::{FullSyncProgress, NormalSyncProgress, SyncStage}, sync::{FullSyncProgress, NormalSyncProgress, SyncStage},
}; };

View File

@ -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::{ use crate::{
backend_proto as pb, pb,
prelude::*, prelude::*,
scheduler::{ scheduler::{
answering::{CardAnswer, Rating}, answering::{CardAnswer, Rating},

View File

@ -5,9 +5,9 @@ mod answering;
mod states; mod states;
use super::Backend; 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::{ use crate::{
backend_proto as pb, pb,
prelude::*, prelude::*,
scheduler::{ scheduler::{
new::NewCardDueOrder, new::NewCardDueOrder,

View File

@ -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::{backend_proto as pb, scheduler::states::FilteredState}; use crate::{pb, scheduler::states::FilteredState};
impl From<FilteredState> for pb::scheduling_state::Filtered { impl From<FilteredState> for pb::scheduling_state::Filtered {
fn from(state: FilteredState) -> Self { fn from(state: FilteredState) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::LearnState}; use crate::{pb, scheduler::states::LearnState};
impl From<pb::scheduling_state::Learning> for LearnState { impl From<pb::scheduling_state::Learning> for LearnState {
fn from(state: pb::scheduling_state::Learning) -> Self { fn from(state: pb::scheduling_state::Learning) -> Self {

View File

@ -11,7 +11,7 @@ mod rescheduling;
mod review; mod review;
use crate::{ use crate::{
backend_proto as pb, pb,
scheduler::states::{CardState, NewState, NextCardStates, NormalState}, scheduler::states::{CardState, NewState, NextCardStates, NormalState},
}; };

View File

@ -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::{backend_proto as pb, scheduler::states::NewState}; use crate::{pb, scheduler::states::NewState};
impl From<pb::scheduling_state::New> for NewState { impl From<pb::scheduling_state::New> for NewState {
fn from(state: pb::scheduling_state::New) -> Self { fn from(state: pb::scheduling_state::New) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::NormalState}; use crate::{pb, scheduler::states::NormalState};
impl From<NormalState> for pb::scheduling_state::Normal { impl From<NormalState> for pb::scheduling_state::Normal {
fn from(state: NormalState) -> Self { fn from(state: NormalState) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::PreviewState}; use crate::{pb, scheduler::states::PreviewState};
impl From<pb::scheduling_state::Preview> for PreviewState { impl From<pb::scheduling_state::Preview> for PreviewState {
fn from(state: pb::scheduling_state::Preview) -> Self { fn from(state: pb::scheduling_state::Preview) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::RelearnState}; use crate::{pb, scheduler::states::RelearnState};
impl From<pb::scheduling_state::Relearning> for RelearnState { impl From<pb::scheduling_state::Relearning> for RelearnState {
fn from(state: pb::scheduling_state::Relearning) -> Self { fn from(state: pb::scheduling_state::Relearning) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::ReschedulingFilterState}; use crate::{pb, scheduler::states::ReschedulingFilterState};
impl From<pb::scheduling_state::ReschedulingFilter> for ReschedulingFilterState { impl From<pb::scheduling_state::ReschedulingFilter> for ReschedulingFilterState {
fn from(state: pb::scheduling_state::ReschedulingFilter) -> Self { fn from(state: pb::scheduling_state::ReschedulingFilter) -> Self {

View File

@ -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::{backend_proto as pb, scheduler::states::ReviewState}; use crate::{pb, scheduler::states::ReviewState};
impl From<pb::scheduling_state::Review> for ReviewState { impl From<pb::scheduling_state::Review> for ReviewState {
fn from(state: pb::scheduling_state::Review) -> Self { fn from(state: pb::scheduling_state::Review) -> Self {

View File

@ -3,7 +3,7 @@
use std::str::FromStr; 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 { impl browser_table::Column {
pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column { pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column {

View File

@ -7,11 +7,11 @@ mod search_node;
use std::{str::FromStr, sync::Arc}; use std::{str::FromStr, sync::Arc};
use super::{notes::to_note_ids, Backend}; 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::{ use crate::{
backend_proto as pb,
backend_proto::sort_order::Value as SortOrderProto,
browser_table::Column, browser_table::Column,
pb,
pb::sort_order::Value as SortOrderProto,
prelude::*, prelude::*,
search::{replace_search_node, JoinSearches, Node, SortMode}, search::{replace_search_node, JoinSearches, Node, SortMode},
}; };

View File

@ -4,7 +4,7 @@
use itertools::Itertools; use itertools::Itertools;
use crate::{ use crate::{
backend_proto as pb, pb,
prelude::*, prelude::*,
search::{ search::{
parse_search, Negated, Node, PropertyKind, RatingKind, SearchNode, StateKind, TemplateKind, parse_search, Negated, Node, PropertyKind, RatingKind, SearchNode, StateKind, TemplateKind,

View File

@ -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 super::Backend; use super::Backend;
pub(super) use crate::backend_proto::stats_service::Service as StatsService; pub(super) use crate::pb::stats_service::Service as StatsService;
use crate::{backend_proto as pb, prelude::*, revlog::RevlogReviewKind}; use crate::{pb, prelude::*, revlog::RevlogReviewKind};
impl StatsService for Backend { impl StatsService for Backend {
fn card_stats(&self, input: pb::CardId) -> Result<pb::CardStatsResponse> { fn card_stats(&self, input: pb::CardId) -> Result<pb::CardStatsResponse> {

View File

@ -9,10 +9,10 @@ use futures::future::{AbortHandle, AbortRegistration, Abortable};
use slog::warn; use slog::warn;
use super::{progress::AbortHandleSlot, Backend}; 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::{ use crate::{
backend_proto as pb,
media::MediaManager, media::MediaManager,
pb,
prelude::*, prelude::*,
sync::{ sync::{
get_remote_sync_meta, http::SyncRequest, sync_abort, sync_login, FullSyncProgress, get_remote_sync_meta, http::SyncRequest, sync_abort, sync_login, FullSyncProgress,

View File

@ -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 super::{notes::to_note_ids, Backend}; use super::{notes::to_note_ids, Backend};
pub(super) use crate::backend_proto::tags_service::Service as TagsService; pub(super) use crate::pb::tags_service::Service as TagsService;
use crate::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
impl TagsService for Backend { impl TagsService for Backend {
fn clear_unused_tags(&self, _input: pb::Empty) -> Result<pb::OpChangesWithCount> { fn clear_unused_tags(&self, _input: pb::Empty) -> Result<pb::OpChangesWithCount> {

View File

@ -7,10 +7,10 @@ use itertools::Itertools;
use strum::{Display, EnumIter, EnumString, IntoEnumIterator}; use strum::{Display, EnumIter, EnumString, IntoEnumIterator};
use crate::{ use crate::{
backend_proto as pb,
card::{CardQueue, CardType}, card::{CardQueue, CardType},
card_rendering::prettify_av_tags, card_rendering::prettify_av_tags,
notetype::{CardTemplate, NotetypeKind}, notetype::{CardTemplate, NotetypeKind},
pb,
prelude::*, prelude::*,
scheduler::{timespan::time_span, timing::SchedTimingToday}, scheduler::{timespan::time_span, timing::SchedTimingToday},
template::RenderedNode, template::RenderedNode,

View File

@ -3,7 +3,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
mod parser; mod parser;
mod writer; mod writer;

View File

@ -5,7 +5,7 @@ use std::fmt::Write as _;
use super::{CardNodes, Directive, Node, OtherDirective, TtsDirective}; use super::{CardNodes, Directive, Node, OtherDirective, TtsDirective};
use crate::{ use crate::{
backend_proto as pb, pb,
prelude::*, prelude::*,
text::{decode_entities, strip_html_for_tts}, text::{decode_entities, strip_html_for_tts},
}; };

View File

@ -14,8 +14,7 @@ use itertools::Itertools;
use log::error; use log::error;
use crate::{ use crate::{
backend_proto::preferences::BackupLimits, import_export::package::export_colpkg_from_data, log, import_export::package::export_colpkg_from_data, log, pb::preferences::BackupLimits, prelude::*,
prelude::*,
}; };
const BACKUP_FORMAT_STRING: &str = "backup-%Y-%m-%d-%H.%M.%S.colpkg"; const BACKUP_FORMAT_STRING: &str = "backup-%Y-%m-%d-%H.%M.%S.colpkg";

View File

@ -18,7 +18,7 @@ pub use self::{
bool::BoolKey, deck::DeckConfigKey, notetype::get_aux_notetype_config_key, bool::BoolKey, deck::DeckConfigKey, notetype::get_aux_notetype_config_key,
number::I32ConfigKey, string::StringKey, number::I32ConfigKey, string::StringKey,
}; };
use crate::{backend_proto::preferences::BackupLimits, prelude::*}; use crate::{pb::preferences::BackupLimits, prelude::*};
/// Only used when updating/undoing. /// Only used when updating/undoing.
#[derive(Debug)] #[derive(Debug)]

View File

@ -8,7 +8,7 @@ mod update;
pub use schema11::{DeckConfSchema11, NewCardOrderSchema11}; pub use schema11::{DeckConfSchema11, NewCardOrderSchema11};
pub use update::UpdateDeckConfigsRequest; pub use update::UpdateDeckConfigsRequest;
pub use crate::backend_proto::deck_config::{ pub use crate::pb::deck_config::{
config::{ config::{
LeechAction, NewCardGatherPriority, NewCardInsertOrder, NewCardSortOrder, ReviewCardOrder, LeechAction, NewCardGatherPriority, NewCardInsertOrder, NewCardSortOrder, ReviewCardOrder,
ReviewMix, ReviewMix,

View File

@ -9,9 +9,9 @@ use std::{
}; };
use crate::{ use crate::{
backend_proto as pb,
backend_proto::deck_configs_for_update::{ConfigWithExtra, CurrentDeck},
config::StringKey, config::StringKey,
pb,
pb::deck_configs_for_update::{ConfigWithExtra, CurrentDeck},
prelude::*, prelude::*,
}; };

View File

@ -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 std::collections::HashMap; use std::collections::HashMap;
use crate::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct DueCounts { pub(crate) struct DueCounts {

View File

@ -21,7 +21,7 @@ pub(crate) use name::immediate_parent_name;
pub use name::NativeDeckName; pub use name::NativeDeckName;
pub use schema11::DeckSchema11; pub use schema11::DeckSchema11;
pub use crate::backend_proto::{ pub use crate::pb::{
deck::{ deck::{
filtered::{search_term::Order as FilteredSearchOrder, SearchTerm as FilteredSearchTerm}, filtered::{search_term::Order as FilteredSearchOrder, SearchTerm as FilteredSearchTerm},
kind_container::Kind as DeckKind, kind_container::Kind as DeckKind,

View File

@ -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 super::DeckCommon; use super::DeckCommon;
use crate::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
impl Deck { impl Deck {
pub(super) fn reset_stats_if_day_changed(&mut self, today: u32) { pub(super) fn reset_stats_if_day_changed(&mut self, today: u32) {

View File

@ -14,10 +14,8 @@ use super::{
limits::{remaining_limits_map, RemainingLimits}, limits::{remaining_limits_map, RemainingLimits},
DueCounts, DueCounts,
}; };
pub use crate::backend_proto::set_deck_collapsed_request::Scope as DeckCollapseScope; pub use crate::pb::set_deck_collapsed_request::Scope as DeckCollapseScope;
use crate::{ use crate::{config::SchedulerVersion, ops::OpOutput, pb::DeckTreeNode, prelude::*, undo::Op};
backend_proto::DeckTreeNode, config::SchedulerVersion, ops::OpOutput, prelude::*, undo::Op,
};
fn deck_names_to_tree(names: impl Iterator<Item = (DeckId, String)>) -> DeckTreeNode { fn deck_names_to_tree(names: impl Iterator<Item = (DeckId, String)>) -> DeckTreeNode {
let mut top = DeckTreeNode::default(); let mut top = DeckTreeNode::default();

View File

@ -8,7 +8,7 @@ pub mod text;
use std::marker::PhantomData; 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::{ use crate::{
prelude::*, prelude::*,
text::{ text::{

View File

@ -6,7 +6,7 @@ use std::{fs::File, io::Read};
use prost::Message; use prost::Message;
use zip::ZipArchive; 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}; use crate::{error::ImportError, prelude::*, storage::SchemaVersion};
impl Version { impl Version {

View File

@ -11,4 +11,4 @@ pub(crate) use colpkg::export::export_colpkg_from_data;
pub use colpkg::import::import_colpkg; pub use colpkg::import::import_colpkg;
pub(self) use meta::{Meta, Version}; 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};

View File

@ -9,9 +9,9 @@ use regex::Regex;
use super::metadata::Delimiter; use super::metadata::Delimiter;
use crate::{ use crate::{
backend_proto::ExportNoteCsvRequest,
import_export::{ExportProgress, IncrementableProgress}, import_export::{ExportProgress, IncrementableProgress},
notetype::RenderCardOutput, notetype::RenderCardOutput,
pb::ExportNoteCsvRequest,
prelude::*, prelude::*,
search::{SearchNode, SortMode}, search::{SearchNode, SortMode},
template::RenderedNode, template::RenderedNode,

View File

@ -239,7 +239,7 @@ mod test {
use std::io::Cursor; use std::io::Cursor;
use super::*; use super::*;
use crate::backend_proto::import_export::csv_metadata::MappedNotetype; use crate::pb::import_export::csv_metadata::MappedNotetype;
macro_rules! import { macro_rules! import {
($metadata:expr, $csv:expr) => {{ ($metadata:expr, $csv:expr) => {{

View File

@ -11,17 +11,17 @@ use itertools::Itertools;
use strum::IntoEnumIterator; use strum::IntoEnumIterator;
use super::import::build_csv_reader; 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}, csv_metadata::{Deck as CsvDeck, Delimiter, MappedNotetype, Notetype as CsvNotetype},
import_csv_request::DupeResolution, import_csv_request::DupeResolution,
CsvMetadata, CsvMetadata,
}; };
use crate::{ use crate::{
backend_proto::StringList,
config::I32ConfigKey, config::I32ConfigKey,
error::ImportError, error::ImportError,
import_export::text::NameOrId, import_export::text::NameOrId,
notetype::NoteField, notetype::NoteField,
pb::StringList,
prelude::*, prelude::*,
text::{html_to_text_line, is_html}, text::{html_to_text_line, is_html},
}; };

View File

@ -8,7 +8,7 @@ mod json;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use super::LogNote; use super::LogNote;
use crate::backend_proto::import_csv_request::DupeResolution; use crate::pb::import_csv_request::DupeResolution;
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]

View File

@ -5,7 +5,6 @@
pub mod adding; pub mod adding;
pub mod backend; pub mod backend;
mod backend_proto;
pub mod browser_table; pub mod browser_table;
pub mod card; pub mod card;
pub mod card_rendering; pub mod card_rendering;
@ -28,6 +27,7 @@ pub mod media;
pub mod notes; pub mod notes;
pub mod notetype; pub mod notetype;
pub mod ops; pub mod ops;
pub mod pb;
mod preferences; mod preferences;
pub mod prelude; pub mod prelude;
pub mod revlog; pub mod revlog;

View File

@ -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
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/"; static HELP_SITE: &str = "https://docs.ankiweb.net/";

View File

@ -12,14 +12,14 @@ use itertools::Itertools;
use num_integer::Integer; use num_integer::Integer;
use crate::{ use crate::{
backend_proto as pb,
backend_proto::note_fields_check_response::State as NoteFieldsState,
cloze::contains_cloze, cloze::contains_cloze,
decks::DeckId, decks::DeckId,
define_newtype, define_newtype,
error::{AnkiError, Result}, error::{AnkiError, Result},
notetype::{CardGenContext, NoteField, Notetype, NotetypeId}, notetype::{CardGenContext, NoteField, Notetype, NotetypeId},
ops::StateChanges, ops::StateChanges,
pb,
pb::note_fields_check_response::State as NoteFieldsState,
prelude::*, prelude::*,
template::field_is_empty, template::field_is_empty,
text::{ensure_string_in_nfc, normalize_to_nfc, strip_html_preserving_media_filenames}, text::{ensure_string_in_nfc, normalize_to_nfc, strip_html_preserving_media_filenames},

View File

@ -3,8 +3,8 @@
use super::{NoteFieldConfig, NoteFieldProto}; use super::{NoteFieldConfig, NoteFieldProto};
use crate::{ use crate::{
backend_proto::UInt32,
error::{AnkiError, Result}, error::{AnkiError, Result},
pb::UInt32,
}; };
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]

View File

@ -29,7 +29,7 @@ pub use stock::all_stock_notetypes;
pub use templates::CardTemplate; pub use templates::CardTemplate;
use unicase::UniCase; use unicase::UniCase;
pub use crate::backend_proto::{ pub use crate::pb::{
notetype::{ notetype::{
config::{ config::{
card_requirement::Kind as CardRequirementKind, CardRequirement, Kind as NotetypeKind, card_requirement::Kind as CardRequirementKind, CardRequirement, Kind as NotetypeKind,

View File

@ -3,11 +3,11 @@
use super::NotetypeConfig; use super::NotetypeConfig;
use crate::{ use crate::{
backend_proto::stock_notetype::Kind,
config::{ConfigEntry, ConfigKey}, config::{ConfigEntry, ConfigKey},
error::Result, error::Result,
i18n::I18n, i18n::I18n,
notetype::Notetype, notetype::Notetype,
pb::stock_notetype::Kind,
storage::SqliteStorage, storage::SqliteStorage,
timestamp::TimestampSecs, timestamp::TimestampSecs,
}; };

View File

@ -3,9 +3,9 @@
use super::{CardTemplateConfig, CardTemplateProto}; use super::{CardTemplateConfig, CardTemplateProto};
use crate::{ use crate::{
backend_proto::UInt32,
decks::DeckId, decks::DeckId,
error::{AnkiError, Result}, error::{AnkiError, Result},
pb::UInt32,
template::ParsedTemplate, template::ParsedTemplate,
timestamp::TimestampSecs, timestamp::TimestampSecs,
types::Usn, types::Usn,

View File

@ -2,13 +2,13 @@
// 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::{ use crate::{
backend_proto::{
preferences::{scheduling::NewReviewMix as NewRevMixPB, Editing, Reviewing, Scheduling},
Preferences,
},
collection::Collection, collection::Collection,
config::{BoolKey, StringKey}, config::{BoolKey, StringKey},
error::Result, error::Result,
pb::{
preferences::{scheduling::NewReviewMix as NewRevMixPB, Editing, Reviewing, Scheduling},
Preferences,
},
prelude::*, prelude::*,
scheduler::timing::local_minutes_west_for_stamp, scheduler::timing::local_minutes_west_for_stamp,
}; };

View File

@ -19,10 +19,10 @@ use super::{
timing::SchedTimingToday, timing::SchedTimingToday,
}; };
use crate::{ use crate::{
backend_proto,
card::CardQueue, card::CardQueue,
deckconfig::{DeckConfig, LeechAction}, deckconfig::{DeckConfig, LeechAction},
decks::Deck, decks::Deck,
pb,
prelude::*, prelude::*,
}; };
@ -329,7 +329,7 @@ impl Collection {
self.update_deck_stats( self.update_deck_stats(
updater.timing.days_elapsed, updater.timing.days_elapsed,
usn, usn,
backend_proto::UpdateStatsRequest { pb::UpdateStatsRequest {
deck_id: updater.deck.id.0, deck_id: updater.deck.id.0,
new_delta, new_delta,
review_delta, review_delta,

View File

@ -3,12 +3,12 @@
use super::timing::SchedTimingToday; use super::timing::SchedTimingToday;
use crate::{ use crate::{
backend_proto::{ card::CardQueue,
config::SchedulerVersion,
pb::{
bury_or_suspend_cards_request::Mode as BuryOrSuspendMode, bury_or_suspend_cards_request::Mode as BuryOrSuspendMode,
unbury_deck_request::Mode as UnburyDeckMode, unbury_deck_request::Mode as UnburyDeckMode,
}, },
card::CardQueue,
config::SchedulerVersion,
prelude::*, prelude::*,
search::{JoinSearches, SearchNode, SortMode, StateKind}, search::{JoinSearches, SearchNode, SortMode, StateKind},
}; };

View File

@ -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::{backend_proto as pb, prelude::*}; use crate::{pb, prelude::*};
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct CongratsInfo { pub(crate) struct CongratsInfo {
@ -51,7 +51,7 @@ mod test {
let info = col.congrats_info().unwrap(); let info = col.congrats_info().unwrap();
assert_eq!( assert_eq!(
info, info,
crate::backend_proto::CongratsInfoResponse { crate::pb::CongratsInfoResponse {
learn_remaining: 0, learn_remaining: 0,
review_remaining: false, review_remaining: false,
new_remaining: false, new_remaining: false,

View File

@ -5,13 +5,13 @@ use std::collections::HashSet;
use super::FilteredDeckForUpdate; use super::FilteredDeckForUpdate;
use crate::{ use crate::{
backend_proto::{
self as pb,
custom_study_request::{cram::CramKind, Cram, Value as CustomStudyValue},
},
config::DeckConfigKey, config::DeckConfigKey,
decks::{FilteredDeck, FilteredSearchOrder, FilteredSearchTerm}, decks::{FilteredDeck, FilteredSearchOrder, FilteredSearchTerm},
error::{CustomStudyError, FilteredDeckError}, error::{CustomStudyError, FilteredDeckError},
pb::{
self as pb,
custom_study_request::{cram::CramKind, Cram, Value as CustomStudyValue},
},
prelude::*, prelude::*,
search::{JoinSearches, Negated, PropertyKind, RatingKind, SearchNode, StateKind}, 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 { mod test {
use super::*; use super::*;
use crate::{ use crate::{
backend_proto::{ collection::open_test_collection,
pb::{
scheduler::custom_study_request::{cram::CramKind, Cram, Value}, scheduler::custom_study_request::{cram::CramKind, Cram, Value},
CustomStudyRequest, CustomStudyRequest,
}, },
collection::open_test_collection,
}; };
#[test] #[test]

View File

@ -5,7 +5,7 @@ use std::collections::{HashMap, HashSet};
use rand::seq::SliceRandom; use rand::seq::SliceRandom;
pub use crate::backend_proto::scheduler::{ pub use crate::pb::scheduler::{
schedule_cards_as_new_request::Context as ScheduleAsNewContext, schedule_cards_as_new_request::Context as ScheduleAsNewContext,
ScheduleCardsAsNewDefaultsResponse, ScheduleCardsAsNewDefaultsResponse,
}; };

View File

@ -264,9 +264,9 @@ impl Collection {
mod test { mod test {
use super::*; use super::*;
use crate::{ use crate::{
backend_proto::deck_config::config::{NewCardGatherPriority, NewCardSortOrder},
card::{CardQueue, CardType}, card::{CardQueue, CardType},
collection::open_test_collection, collection::open_test_collection,
pb::deck_config::config::{NewCardGatherPriority, NewCardSortOrder},
}; };
impl Collection { impl Collection {

View File

@ -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::{ use crate::{
backend_proto as pb,
card::{CardQueue, CardType}, card::{CardQueue, CardType},
pb,
prelude::*, prelude::*,
revlog::RevlogEntry, revlog::RevlogEntry,
}; };

View File

@ -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::{ use crate::{
backend_proto as pb,
config::{BoolKey, Weekday}, config::{BoolKey, Weekday},
pb,
prelude::*, prelude::*,
revlog::RevlogEntry, revlog::RevlogEntry,
search::SortMode, search::SortMode,

View File

@ -11,8 +11,8 @@ use rusqlite::{
use super::SqliteStorage; use super::SqliteStorage;
use crate::{ use crate::{
backend_proto as pb,
error::Result, error::Result,
pb,
prelude::*, prelude::*,
revlog::{RevlogEntry, RevlogReviewKind}, revlog::{RevlogEntry, RevlogReviewKind},
}; };

View File

@ -6,7 +6,7 @@ use std::{fs, path::PathBuf};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use super::{Chunk, Graves, SanityCheckCounts, UnchunkedChanges}; 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)] #[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum SyncRequest { pub enum SyncRequest {

View File

@ -16,7 +16,6 @@ use serde_tuple::Serialize_tuple;
pub(crate) use server::{LocalServer, SyncServer}; pub(crate) use server::{LocalServer, SyncServer};
use crate::{ use crate::{
backend_proto::{sync_status_response, SyncStatusResponse},
card::{Card, CardQueue, CardType}, card::{Card, CardQueue, CardType},
deckconfig::DeckConfSchema11, deckconfig::DeckConfSchema11,
decks::DeckSchema11, decks::DeckSchema11,
@ -24,6 +23,7 @@ use crate::{
io::atomic_rename, io::atomic_rename,
notes::Note, notes::Note,
notetype::{Notetype, NotetypeSchema11}, notetype::{Notetype, NotetypeSchema11},
pb::{sync_status_response, SyncStatusResponse},
prelude::*, prelude::*,
revlog::RevlogEntry, revlog::RevlogEntry,
serde::{default_on_invalid, deserialize_int_from_number}, serde::{default_on_invalid, deserialize_int_from_number},

View File

@ -6,7 +6,7 @@ use std::{collections::HashSet, iter::Peekable};
use unicase::UniCase; use unicase::UniCase;
use super::{immediate_parent_name_unicase, Tag}; use super::{immediate_parent_name_unicase, Tag};
use crate::{backend_proto::TagTreeNode, prelude::*}; use crate::{pb::TagTreeNode, prelude::*};
impl Collection { impl Collection {
pub fn tag_tree(&mut self) -> Result<TagTreeNode> { pub fn tag_tree(&mut self) -> Result<TagTreeNode> {