nvim_rs/exttypes/
mod.rs

1//! Buffers, windows, tabpages of neovim
2mod buffer;
3mod tabpage;
4mod window;
5
6pub use buffer::Buffer;
7pub use tabpage::Tabpage;
8pub use window::Window;
9
10/// A macro to implement trait for the [`exttypes`](crate::exttypes)
11#[macro_export]
12macro_rules! impl_exttype_traits {
13  ($ext:ident) => {
14    impl<W> PartialEq for $ext<W>
15    where
16      W: AsyncWrite + Send + Unpin + 'static,
17    {
18      fn eq(&self, other: &Self) -> bool {
19        self.code_data == other.code_data && self.neovim == other.neovim
20      }
21    }
22    impl<W> Eq for $ext<W> where W: AsyncWrite + Send + Unpin + 'static {}
23
24    impl<W> Clone for $ext<W>
25    where
26      W: AsyncWrite + Send + Unpin + 'static,
27    {
28      fn clone(&self) -> Self {
29        Self {
30          code_data: self.code_data.clone(),
31          neovim: self.neovim.clone(),
32        }
33      }
34    }
35
36    impl<W> IntoVal<Value> for &$ext<W>
37    where
38      W: AsyncWrite + Send + Unpin + 'static,
39    {
40      fn into_val(self) -> Value {
41        self.code_data.clone()
42      }
43    }
44  };
45}