mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
convert from protobuf enum, rather than the underlying i32
This commit is contained in:
parent
152eaa1798
commit
1a5b5f09cc
1 changed files with 13 additions and 8 deletions
|
@ -6,6 +6,7 @@ use crate::{
|
||||||
backend::dbproxy::db_command_bytes,
|
backend::dbproxy::db_command_bytes,
|
||||||
backend_proto as pb,
|
backend_proto as pb,
|
||||||
backend_proto::builtin_search_order::BuiltinSortKind,
|
backend_proto::builtin_search_order::BuiltinSortKind,
|
||||||
|
backend_proto::concatenate_searches_in::Separator as BoolSeparatorProto,
|
||||||
backend_proto::{
|
backend_proto::{
|
||||||
AddOrUpdateDeckConfigLegacyIn, BackendResult, Empty, RenderedTemplateReplacement,
|
AddOrUpdateDeckConfigLegacyIn, BackendResult, Empty, RenderedTemplateReplacement,
|
||||||
},
|
},
|
||||||
|
@ -274,13 +275,11 @@ impl From<pb::DeckConfigId> for DeckConfID {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<i32> for BoolSeparator {
|
impl From<BoolSeparatorProto> for BoolSeparator {
|
||||||
fn from(sep: i32) -> Self {
|
fn from(sep: BoolSeparatorProto) -> Self {
|
||||||
use pb::concatenate_searches_in::Separator;
|
match sep {
|
||||||
match Separator::from_i32(sep) {
|
BoolSeparatorProto::And => BoolSeparator::And,
|
||||||
Some(Separator::And) => BoolSeparator::And,
|
BoolSeparatorProto::Or => BoolSeparator::Or,
|
||||||
Some(Separator::Or) => BoolSeparator::Or,
|
|
||||||
None => BoolSeparator::And,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,7 +448,13 @@ impl BackendService for Backend {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn concatenate_searches(&self, input: pb::ConcatenateSearchesIn) -> Result<pb::String> {
|
fn concatenate_searches(&self, input: pb::ConcatenateSearchesIn) -> Result<pb::String> {
|
||||||
Ok(concatenate_searches(input.sep.into(), &input.searches)?.into())
|
Ok(concatenate_searches(
|
||||||
|
BoolSeparatorProto::from_i32(input.sep)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.into(),
|
||||||
|
&input.searches,
|
||||||
|
)?
|
||||||
|
.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace_search_term(&self, input: pb::ReplaceSearchTermIn) -> Result<pb::String> {
|
fn replace_search_term(&self, input: pb::ReplaceSearchTermIn) -> Result<pb::String> {
|
||||||
|
|
Loading…
Reference in a new issue