summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-08-19 14:04:05 +0200
committerJustus Winter <justus@sequoia-pgp.org>2021-08-26 12:59:55 +0200
commit31b4b189a5b23f570e3e5b712031a688d5c0633f (patch)
tree5f4d37e96091140df8f1a2988b49014a8179aa2d /ipc
parente54c8a135d141fd6bfa84fa9b0aa45d5aeb22c34 (diff)
ipc: Move the types from the core module to the top-level.
Diffstat (limited to 'ipc')
-rw-r--r--ipc/src/assuan/mod.rs4
-rw-r--r--ipc/src/core.rs17
-rw-r--r--ipc/src/lib.rs8
3 files changed, 15 insertions, 14 deletions
diff --git a/ipc/src/assuan/mod.rs b/ipc/src/assuan/mod.rs
index be20b447..a1337ed4 100644
--- a/ipc/src/assuan/mod.rs
+++ b/ipc/src/assuan/mod.rs
@@ -70,8 +70,8 @@ assert_send_and_sync!(Client);
enum WriteState {
Ready(WriteHalf<IpcStream>),
- Sending(Pin<Box<dyn Future<Output = Result<WriteHalf<IpcStream>,
- anyhow::Error>> + Send + Sync>>),
+ Sending(Pin<Box<dyn Future<Output = Result<WriteHalf<IpcStream>>>
+ + Send + Sync>>),
Transitioning,
Dead,
}
diff --git a/ipc/src/core.rs b/ipc/src/core.rs
index 978d60fd..d6895e01 100644
--- a/ipc/src/core.rs
+++ b/ipc/src/core.rs
@@ -10,7 +10,7 @@
//! `Context::new`:
//!
//! ```no_run
-//! # use sequoia_ipc::core::{Context, Result};
+//! # use sequoia_ipc::{Context, Result};
//! # fn main() -> Result<()> {
//! let c = Context::new();
//! # Ok(())
@@ -21,6 +21,8 @@
use std::path::{Path, PathBuf};
+use crate::Result;
+
/// A `Context` for Sequoia.
///
/// # Examples
@@ -29,7 +31,7 @@ use std::path::{Path, PathBuf};
/// `Context::new`:
///
/// ```no_run
-/// # use sequoia_ipc::core::{Context, Result};
+/// # use sequoia_ipc::{Context, Result};
/// # fn main() -> Result<()> {
/// let c = Context::new()?;
/// # Ok(())
@@ -40,7 +42,7 @@ use std::path::{Path, PathBuf};
/// `Context::configure`:
///
/// ```
-/// # use sequoia_ipc::core::{Context, IPCPolicy, Result};
+/// # use sequoia_ipc::{Context, IPCPolicy, Result};
/// # fn main() -> Result<()> {
/// let c = Context::configure()
/// # .ephemeral()
@@ -133,7 +135,7 @@ impl Context {
/// `Context::configure`:
///
/// ```
-/// # use sequoia_ipc::core::{Context, IPCPolicy, Result};
+/// # use sequoia_ipc::{Context, IPCPolicy, Result};
/// # fn main() -> Result<()> {
/// let c = Context::configure()
/// # .ephemeral()
@@ -147,7 +149,7 @@ impl Context {
/// one-shot programs:
///
/// ```
-/// # use sequoia_ipc::core::{Context, Result};
+/// # use sequoia_ipc::{Context, Result};
/// # use std::path::Path;
/// # fn main() -> Result<()> {
/// let c = Context::configure().ephemeral().build()?;
@@ -232,11 +234,6 @@ impl Config {
}
}
-/* Error handling. */
-
-/// Result type for Sequoia.
-pub type Result<T> = ::std::result::Result<T, anyhow::Error>;
-
/* IPC policy. */
/// IPC policy for Sequoia.
diff --git a/ipc/src/lib.rs b/ipc/src/lib.rs
index 9cb0fe1f..a212d5a8 100644
--- a/ipc/src/lib.rs
+++ b/ipc/src/lib.rs
@@ -45,7 +45,7 @@ use std::io::{self, Read, Write};
use std::net::{Ipv4Addr, SocketAddr, TcpStream, TcpListener};
use std::path::PathBuf;
-use anyhow::{anyhow, Result};
+use anyhow::anyhow;
use fs2::FileExt;
use tokio_util::compat::Compat;
@@ -72,7 +72,8 @@ pub mod keybox;
mod keygrip;
pub use self::keygrip::Keygrip;
pub mod sexp;
-pub mod core;
+mod core;
+pub use crate::core::{Config, Context, IPCPolicy};
#[cfg(test)]
mod tests;
@@ -508,6 +509,9 @@ pub enum Error {
ConnectionClosed(Vec<u8>),
}
+/// Result type specialization.
+pub type Result<T> = ::std::result::Result<T, anyhow::Error>;
+
// Global initialization and cleanup of the Windows Sockets API (WSA) module.
// NOTE: This has to be top-level in order for `ctor::{ctor, dtor}` to work.
#[cfg(windows)]