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
46
47
#![forbid(unsafe_code)]

// TODO error type?
// TODO split up
// Implement handshake

use std::{env, path::PathBuf};

pub use wire::PendingRequestResult; // XXX types? names?
pub mod ei;
mod eiproto_ei;
mod eiproto_eis;
mod eiproto_enum;
pub mod eis;
pub mod event; // XXX reorganize?
pub mod handshake; // XXX ^
mod object;
#[doc(hidden)] // TODO
pub mod request;
pub use object::Object;
mod util;
mod wire;
// TODO make (a version of) this public and documented?
#[doc(hidden)]
pub use wire::Interface;
pub use wire::ParseError;

#[cfg(feature = "calloop")]
#[doc(hidden)] // TODO
pub mod calloop;
#[cfg(feature = "tokio")]
pub mod tokio;

// TODO versioning?

mod private {
    pub trait Sealed {}
}

// XXX
// Want to fallback to higher number if exists, on server?
// create on server, not client.
pub fn default_socket_path() -> Option<PathBuf> {
    let mut path = PathBuf::from(env::var_os("XDG_RUNTIME_DIR")?);
    path.push("eis-0");
    Some(path)
}