1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Buffers, windows, tabpages of neovim
mod buffer;
mod tabpage;
mod window;

pub use buffer::Buffer;
pub use tabpage::Tabpage;
pub use window::Window;

/// A macro to implement trait for the [`exttypes`](crate::exttypes)
#[macro_export]
macro_rules! impl_exttype_traits {
  ($ext:ident) => {
    impl<W> PartialEq for $ext<W>
    where
      W: AsyncWrite + Send + Unpin + 'static,
    {
      fn eq(&self, other: &Self) -> bool {
        self.code_data == other.code_data && self.neovim == other.neovim
      }
    }
    impl<W> Eq for $ext<W> where W: AsyncWrite + Send + Unpin + 'static {}

    impl<W> Clone for $ext<W>
    where
      W: AsyncWrite + Send + Unpin + 'static,
    {
      fn clone(&self) -> Self {
        Self {
          code_data: self.code_data.clone(),
          neovim: self.neovim.clone(),
        }
      }
    }

    impl<W> IntoVal<Value> for &$ext<W>
    where
      W: AsyncWrite + Send + Unpin + 'static,
    {
      fn into_val(self) -> Value {
        self.code_data.clone()
      }
    }
  };
}