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
// 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 {
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
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::*,
};

View File

@ -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::{

View File

@ -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,
};

View File

@ -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::*,
};

View File

@ -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::*,
};

View File

@ -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,
};

View File

@ -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::*,
};

View File

@ -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<Vec<u8>> for pb::Json {
fn from(json: Vec<u8>) -> Self {

View File

@ -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},
};

View File

@ -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,
};

View File

@ -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<pb::String> {

View File

@ -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::*,
};

View File

@ -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 {

View File

@ -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::*,
};

View File

@ -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::*,
};

View File

@ -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},
};

View File

@ -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},
};

View File

@ -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},

View File

@ -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,

View File

@ -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<FilteredState> for pb::scheduling_state::Filtered {
fn from(state: FilteredState) -> Self {

View File

@ -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<pb::scheduling_state::Learning> for LearnState {
fn from(state: pb::scheduling_state::Learning) -> Self {

View File

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

View File

@ -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<pb::scheduling_state::New> for NewState {
fn from(state: pb::scheduling_state::New) -> Self {

View File

@ -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<NormalState> for pb::scheduling_state::Normal {
fn from(state: NormalState) -> Self {

View File

@ -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<pb::scheduling_state::Preview> for PreviewState {
fn from(state: pb::scheduling_state::Preview) -> Self {

View File

@ -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<pb::scheduling_state::Relearning> for RelearnState {
fn from(state: pb::scheduling_state::Relearning) -> Self {

View File

@ -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<pb::scheduling_state::ReschedulingFilter> for ReschedulingFilterState {
fn from(state: pb::scheduling_state::ReschedulingFilter) -> Self {

View File

@ -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<pb::scheduling_state::Review> for ReviewState {
fn from(state: pb::scheduling_state::Review) -> Self {

View File

@ -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 {

View File

@ -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},
};

View File

@ -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,

View File

@ -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<pb::CardStatsResponse> {

View File

@ -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,

View File

@ -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<pb::OpChangesWithCount> {

View File

@ -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,

View File

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

View File

@ -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},
};

View File

@ -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";

View File

@ -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)]

View File

@ -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,

View File

@ -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::*,
};

View File

@ -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 {

View File

@ -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,

View File

@ -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) {

View File

@ -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<Item = (DeckId, String)>) -> DeckTreeNode {
let mut top = DeckTreeNode::default();

View File

@ -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::{

View File

@ -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 {

View File

@ -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};

View File

@ -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,

View File

@ -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) => {{

View File

@ -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},
};

View File

@ -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)]

View File

@ -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;

View File

@ -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/";

View File

@ -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},

View File

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

View File

@ -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,

View File

@ -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,
};

View File

@ -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,

View File

@ -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,
};

View File

@ -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,

View File

@ -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},
};

View File

@ -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,

View File

@ -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]

View File

@ -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,
};

View File

@ -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 {

View File

@ -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,
};

View File

@ -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,

View File

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

View File

@ -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 {

View File

@ -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},

View File

@ -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<TagTreeNode> {