heim_common/
lib.rs

1//! This crate shares common functionality across the `heim` sub-crates.
2//!
3//! Do **NOT** use it directly.
4
5#![doc(html_root_url = "https://docs.rs/heim-common/0.0.11")]
6#![deny(
7    unused,
8    unused_imports,
9    unused_features,
10    bare_trait_objects,
11    future_incompatible,
12    missing_debug_implementations,
13    missing_docs,
14    nonstandard_style,
15    dead_code,
16    deprecated
17)]
18#![warn(
19    trivial_casts,
20    trivial_numeric_casts,
21    unused_extern_crates,
22    unused_import_braces,
23    unused_results
24)]
25#![allow(clippy::missing_safety_doc)]
26
27mod errors;
28mod macros;
29#[doc(hidden)]
30pub mod sys;
31pub mod units;
32#[doc(hidden)]
33pub mod utils;
34
35pub use self::errors::{Error, Result};
36
37/// Process identifier type.
38#[cfg(unix)]
39pub type Pid = libc::pid_t;
40
41/// Process identifier type.
42// TODO: Is it a correct type for pid?
43#[cfg(target_os = "windows")]
44pub type Pid = winapi::shared::minwindef::DWORD;
45
46/// Prelude intended to be used across `heim-*` crates.
47///
48/// Consider not to use it in your code, because it is kinda internal
49/// and might change at any time.
50pub mod prelude {
51    pub use super::errors::{Error, Result};
52    pub use super::wrap;
53
54    /// This module tries to mimic `futures` crate structure
55    /// except without re-exporting unused subcrates like `executor` or `compat`.
56    pub mod futures {
57        pub use futures_util::ready;
58        pub use futures_util::task;
59
60        /// Asynchronous values.
61        pub mod future {
62            pub use futures_core::future::*;
63            pub use futures_util::future::*;
64        }
65
66        /// Asynchronous streams.
67        pub mod stream {
68            pub use futures_core::stream::*;
69            pub use futures_util::stream::*;
70        }
71    }
72
73    // And these re-exports are used across the `heim-*` crates,
74    // would be bad to break them
75    pub use self::futures::future::{
76        self, BoxFuture, FusedFuture, Future, FutureExt, TryFutureExt,
77    };
78    pub use self::futures::stream::{
79        self, BoxStream, FusedStream, Stream, StreamExt, TryStreamExt,
80    };
81}