nvim_api/types/
ui_infos.rs

1use nvim_types::{
2    conversion::{self, FromObject},
3    serde::Deserializer,
4    Object,
5};
6use serde::Deserialize;
7
8use crate::serde_utils as utils;
9
10/// Informations about an attached UI.
11#[non_exhaustive]
12#[derive(Clone, Debug, Eq, PartialEq, Deserialize)]
13pub struct UiInfos {
14    /// Channel id or remote UI (not present for TUI).
15    #[serde(rename = "chan", deserialize_with = "utils::zero_is_none")]
16    pub chan_id: Option<u32>,
17
18    pub ext_cmdline: bool,
19    pub ext_hlstate: bool,
20    pub ext_linegrid: bool,
21    pub ext_messages: bool,
22    pub ext_multigrid: bool,
23    pub ext_popupmenu: bool,
24    pub ext_tabline: bool,
25    pub ext_termcolors: bool,
26    pub ext_wildmenu: bool,
27
28    /// Requested height of the UI.
29    pub height: usize,
30
31    pub r#override: bool,
32
33    /// `true` if the UI uses RGB colors.
34    pub rgb: bool,
35
36    /// Requested height of the UI.
37    pub width: usize,
38}
39
40impl FromObject for UiInfos {
41    fn from_object(obj: Object) -> Result<Self, conversion::Error> {
42        Self::deserialize(Deserializer::new(obj)).map_err(Into::into)
43    }
44}