From fee8f5b575e0749b93580124e3eeee569e049a89 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 20 Dec 2020 20:05:20 +0200 Subject: [PATCH] melib/backends: move IsSubscribedFn to backends mod --- melib/src/backends.rs | 15 +++++++++++++++ melib/src/backends/imap.rs | 14 -------------- melib/src/backends/jmap.rs | 14 -------------- melib/src/backends/nntp.rs | 14 -------------- 4 files changed, 15 insertions(+), 42 deletions(-) diff --git a/melib/src/backends.rs b/melib/src/backends.rs index 4b01d47a7..442e0347a 100644 --- a/melib/src/backends.rs +++ b/melib/src/backends.rs @@ -690,3 +690,18 @@ fn test_lazy_count_set() { assert!(!new.insert_existing(10)); assert_eq!(new.len(), 10); } + +pub struct IsSubscribedFn(Box bool + Send + Sync>); + +impl std::fmt::Debug for IsSubscribedFn { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "IsSubscribedFn Box") + } +} + +impl std::ops::Deref for IsSubscribedFn { + type Target = Box bool + Send + Sync>; + fn deref(&self) -> &Box bool + Send + Sync> { + &self.0 + } +} diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs index f1cb52b9f..88efed124 100644 --- a/melib/src/backends/imap.rs +++ b/melib/src/backends/imap.rs @@ -100,20 +100,6 @@ pub struct ImapServerConf { pub timeout: Option, } -struct IsSubscribedFn(Box bool + Send + Sync>); - -impl std::fmt::Debug for IsSubscribedFn { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "IsSubscribedFn Box") - } -} - -impl std::ops::Deref for IsSubscribedFn { - type Target = Box bool + Send + Sync>; - fn deref(&self) -> &Box bool + Send + Sync> { - &self.0 - } -} type Capabilities = HashSet>; #[macro_export] diff --git a/melib/src/backends/jmap.rs b/melib/src/backends/jmap.rs index e20a19822..ed8d7c73a 100644 --- a/melib/src/backends/jmap.rs +++ b/melib/src/backends/jmap.rs @@ -146,20 +146,6 @@ impl JmapServerConf { } } -pub struct IsSubscribedFn(Box bool + Send + Sync>); - -impl std::fmt::Debug for IsSubscribedFn { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "IsSubscribedFn Box") - } -} - -impl std::ops::Deref for IsSubscribedFn { - type Target = Box bool + Send + Sync>; - fn deref(&self) -> &Box bool + Send + Sync> { - &self.0 - } -} macro_rules! get_conf_val { ($s:ident[$var:literal]) => { $s.extra.get($var).ok_or_else(|| { diff --git a/melib/src/backends/nntp.rs b/melib/src/backends/nntp.rs index 48e5c9558..e3fdcfa85 100644 --- a/melib/src/backends/nntp.rs +++ b/melib/src/backends/nntp.rs @@ -66,20 +66,6 @@ pub struct NntpServerConf { pub extension_use: NntpExtensionUse, } -pub struct IsSubscribedFn(Box bool + Send + Sync>); - -impl std::fmt::Debug for IsSubscribedFn { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "IsSubscribedFn Box") - } -} - -impl std::ops::Deref for IsSubscribedFn { - type Target = Box bool + Send + Sync>; - fn deref(&self) -> &Box bool + Send + Sync> { - &self.0 - } -} type Capabilities = HashSet; #[derive(Debug)]