Defines a sealed ImapConnection trait and boxed connection type for IMAP streams.
// Source: https://github.com/jonhoo/rust-imap | License: Apache-2.0 | Copyright 2016 Matt McCoy
// Provided via justclaw.it.com; keep this notice with the code.
use crate::extensions::idle::SetReadTimeout;
use std::fmt::{Debug, Formatter};
use std::io::{Read, Write};
/// Imap connection trait of a read/write stream
pub trait ImapConnection: Read + Write + Send + SetReadTimeout + private::Sealed {}
impl<T> ImapConnection for T where T: Read + Write + Send + SetReadTimeout {}
impl Debug for dyn ImapConnection {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Imap connection")
}
}
/// A boxed connection type
pub type Connection = Box<dyn ImapConnection>;
mod private {
use super::{Read, SetReadTimeout, Write};
pub trait Sealed {}
impl<
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key