nvim_oxi_api/
win_config.rs1use types as nvim;
2
3use crate::choose;
4use crate::ffi::win_config::*;
5use crate::types::*;
6use crate::Result;
7use crate::{Buffer, Window};
8
9pub fn open_win(
15 buf: &Buffer,
16 enter: bool,
17 config: &WindowConfig,
18) -> Result<Window> {
19 let mut err = nvim::Error::new();
20 let handle =
21 unsafe { nvim_open_win(buf.0, enter, &config.into(), &mut err) };
22 choose!(err, Ok(handle.into()))
23}
24
25impl Window {
26 pub fn get_config(&self) -> Result<WindowConfig> {
32 let mut err = nvim::Error::new();
33
34 let out = unsafe {
35 nvim_win_get_config(
36 self.0,
37 #[cfg(feature = "neovim-0-10")] types::arena(),
39 &mut err,
40 )
41 };
42
43 let out = WindowConfig::try_from(out)?;
44
45 choose!(err, Ok(out))
46 }
47
48 pub fn set_config(&mut self, config: &WindowConfig) -> Result<()> {
54 let mut err = nvim::Error::new();
55 unsafe { nvim_win_set_config(self.0, &config.into(), &mut err) };
56 choose!(err, ())
57 }
58}