@@ -4,22 +4,24 @@ use std::ops::{Deref, DerefMut};
4
4
use std:: pin:: Pin ;
5
5
use std:: str;
6
6
7
- use async_channel :: { self as channel , bounded } ;
7
+ # [ cfg ( feature = "async-native-tls" ) ]
8
8
use async_native_tls:: { TlsConnector , TlsStream } ;
9
+
10
+ #[ cfg( all( feature = "async-native-tls" , feature = "runtime-tokio" ) ) ]
11
+ use tokio:: net:: { TcpStream , ToSocketAddrs } ;
12
+
13
+ #[ cfg( all( feature = "async-native-tls" , feature = "runtime-async-std" ) ) ]
14
+ use async_std:: net:: { TcpStream , ToSocketAddrs } ;
15
+
16
+ use async_channel:: { self as channel, bounded} ;
9
17
#[ cfg( feature = "runtime-async-std" ) ]
10
- use async_std:: {
11
- io:: { Read , Write , WriteExt } ,
12
- net:: { TcpStream , ToSocketAddrs } ,
13
- } ;
18
+ use async_std:: io:: { Read , Write , WriteExt } ;
14
19
use extensions:: id:: { format_identification, parse_id} ;
15
20
use extensions:: quota:: parse_get_quota_root;
16
21
use futures:: { io, Stream , StreamExt } ;
17
22
use imap_proto:: { RequestId , Response } ;
18
23
#[ cfg( feature = "runtime-tokio" ) ]
19
- use tokio:: {
20
- io:: { AsyncRead as Read , AsyncWrite as Write , AsyncWriteExt } ,
21
- net:: { TcpStream , ToSocketAddrs } ,
22
- } ;
24
+ use tokio:: io:: { AsyncRead as Read , AsyncWrite as Write , AsyncWriteExt } ;
23
25
24
26
use super :: authenticator:: Authenticator ;
25
27
use super :: error:: { Error , ParseError , Result , ValidateError } ;
@@ -136,6 +138,7 @@ impl<T: Read + Write + Unpin + fmt::Debug> DerefMut for Session<T> {
136
138
/// # Ok(())
137
139
/// # }) }
138
140
/// ```
141
+ #[ cfg( feature = "async-native-tls" ) ]
139
142
pub async fn connect < A : ToSocketAddrs , S : AsRef < str > > (
140
143
addr : A ,
141
144
domain : S ,
@@ -161,6 +164,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Client<T> {
161
164
/// This will upgrade an IMAP client from using a regular TCP connection to use TLS.
162
165
///
163
166
/// The domain parameter is required to perform hostname verification.
167
+ #[ cfg( feature = "async-native-tls" ) ]
164
168
pub async fn secure < S : AsRef < str > > (
165
169
mut self ,
166
170
domain : S ,
@@ -223,7 +227,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Client<T> {
223
227
/// prompting the user for credetials), ownership of the original `Client` needs to be
224
228
/// transferred back to the caller.
225
229
///
226
- /// ```no_run
230
+ /// ```ignore
227
231
/// # fn main() -> async_imap::error::Result<()> {
228
232
/// # async_std::task::block_on(async {
229
233
///
@@ -267,7 +271,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Client<T> {
267
271
/// Authenticate with the server using the given custom `authenticator` to handle the server's
268
272
/// challenge.
269
273
///
270
- /// ```no_run
274
+ /// ```ignore
271
275
/// struct OAuth2 {
272
276
/// user: String,
273
277
/// access_token: String,
0 commit comments