mountos_native/lib.rs
1//! Blocking client for the mountOS native filesystem API over a Unix socket.
2//!
3//! ```no_run
4//! let c = mountos_native::Client::connect("/home/me/.mountOS/sockets/mountos_api_0123456789abcdef.sock")?;
5//! let f = c.open("/a.txt", mountos_native::open_flag::READ_ONLY, 0)?;
6//! let data = f.read_at(0, 4096)?;
7//! # Ok::<(), mountos_native::Error>(())
8//! ```
9//!
10//! The server pushes notices (warm results, watch changes, closing) on the connection that made
11//! the call. A reader thread per connection receives them, and `Client::add_listener` hands every
12//! event to your listeners in order. `Client::wait_warm` and `Client::watch` build on the same
13//! events. With no listener, events go to the logger in `Options`, or to stderr.
14
15// Library code reports failures as errors. Tests may unwrap.
16#![deny(clippy::dbg_macro, clippy::todo, clippy::unimplemented)]
17#![cfg_attr(not(test), deny(clippy::unwrap_used))]
18// A public type that outside code builds or matches carries #[non_exhaustive], so a new field or
19// variant is not a breaking change.
20#![warn(clippy::exhaustive_structs, clippy::exhaustive_enums)]
21
22mod bulk;
23mod client;
24mod dir;
25mod error;
26mod events;
27mod file;
28pub mod frame;
29mod ops_gen;
30mod socket;
31mod walk;
32mod watch;
33pub mod wire;
34
35pub use bulk::StatResult;
36pub use client::{Client, ClientOptions, Options, DEFAULT_MAX_INFLIGHT};
37pub use dir::Dir;
38pub use error::{Error, Result};
39pub use events::{ChangeKind, Event, EventKind, ListenerId, Logger};
40pub use file::{File, WriteItem};
41pub use socket::socket_path;
42pub use walk::{DEFAULT_MAX_DIR_ENTRIES, DEFAULT_MAX_WALK_PENDING};
43pub use watch::Watch;
44pub use wire::{open_flag, DirEntry, FileInfo, FileType, Range, StatfsInfo};