Browse Source

melib/backends: move IsSubscribedFn to backends mod

jmap-eventsource
Manos Pitsidianakis 11 months ago
parent
commit
fee8f5b575
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 15
      melib/src/backends.rs
  2. 14
      melib/src/backends/imap.rs
  3. 14
      melib/src/backends/jmap.rs
  4. 14
      melib/src/backends/nntp.rs

15
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<dyn Fn(&str) -> 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<dyn Fn(&str) -> bool + Send + Sync>;
fn deref(&self) -> &Box<dyn Fn(&str) -> bool + Send + Sync> {
&self.0
}
}

14
melib/src/backends/imap.rs

@ -100,20 +100,6 @@ pub struct ImapServerConf {
pub timeout: Option<Duration>,
}
struct IsSubscribedFn(Box<dyn Fn(&str) -> 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<dyn Fn(&str) -> bool + Send + Sync>;
fn deref(&self) -> &Box<dyn Fn(&str) -> bool + Send + Sync> {
&self.0
}
}
type Capabilities = HashSet<Vec<u8>>;
#[macro_export]

14
melib/src/backends/jmap.rs

@ -146,20 +146,6 @@ impl JmapServerConf {
}
}
pub struct IsSubscribedFn(Box<dyn Fn(&str) -> 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<dyn Fn(&str) -> bool + Send + Sync>;
fn deref(&self) -> &Box<dyn Fn(&str) -> bool + Send + Sync> {
&self.0
}
}
macro_rules! get_conf_val {
($s:ident[$var:literal]) => {
$s.extra.get($var).ok_or_else(|| {

14
melib/src/backends/nntp.rs

@ -66,20 +66,6 @@ pub struct NntpServerConf {
pub extension_use: NntpExtensionUse,
}
pub struct IsSubscribedFn(Box<dyn Fn(&str) -> 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<dyn Fn(&str) -> bool + Send + Sync>;
fn deref(&self) -> &Box<dyn Fn(&str) -> bool + Send + Sync> {
&self.0
}
}
type Capabilities = HashSet<String>;
#[derive(Debug)]

Loading…
Cancel
Save