// 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::*}; impl From> for pb::Json { fn from(json: Vec) -> Self { pb::Json { json } } } impl From for pb::String { fn from(val: String) -> Self { pb::String { val } } } impl From for pb::Bool { fn from(val: bool) -> Self { pb::Bool { val } } } impl From for pb::Int64 { fn from(val: i64) -> Self { pb::Int64 { val } } } impl From for pb::UInt32 { fn from(val: u32) -> Self { pb::UInt32 { val } } } impl From for pb::UInt32 { fn from(val: usize) -> Self { pb::UInt32 { val: val as u32 } } } impl From<()> for pb::Empty { fn from(_val: ()) -> Self { pb::Empty {} } } impl From for CardId { fn from(cid: pb::CardId) -> Self { CardId(cid.cid) } } impl From for Vec { fn from(c: pb::CardIds) -> Self { c.cids.into_iter().map(CardId).collect() } } impl From for NoteId { fn from(nid: pb::NoteId) -> Self { NoteId(nid.nid) } } impl From for NotetypeId { fn from(ntid: pb::NotetypeId) -> Self { NotetypeId(ntid.ntid) } } impl From for DeckConfId { fn from(dcid: pb::DeckConfigId) -> Self { DeckConfId(dcid.dcid) } } impl From> for pb::StringList { fn from(vals: Vec) -> Self { pb::StringList { vals } } }