1pub mod push_fetch;
2
3pub use push_fetch::{
4 enable_sync, get_sync_config, get_sync_status, pull_notes, SyncConfig, SyncStatus,
5};
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum NotesMergeStrategy {
10 Ours,
12 Theirs,
14 Union,
16}
17
18impl std::str::FromStr for NotesMergeStrategy {
19 type Err = String;
20
21 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
22 match s.to_lowercase().as_str() {
23 "ours" => Ok(Self::Ours),
24 "theirs" => Ok(Self::Theirs),
25 "union" => Ok(Self::Union),
26 other => Err(format!("unknown merge strategy: {other}")),
27 }
28 }
29}
30
31impl std::fmt::Display for NotesMergeStrategy {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 match self {
34 Self::Ours => write!(f, "ours"),
35 Self::Theirs => write!(f, "theirs"),
36 Self::Union => write!(f, "union"),
37 }
38 }
39}