Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Sep 23, 2024
1 parent e5bb510 commit 823b791
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1329,9 +1329,11 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {
///
/// Returns `Result` which is `Ok` if the stream is now compressed
/// and `Err` if compression was not enabled.
pub async fn compress(
self,
) -> Result<std::result::Result<DeflateStream<T>, Session<T>>> {
pub async fn compress<F, S>(self, f: F) -> Result<std::result::Result<Session<S>, Session<T>>>
where
S: Read + Write + Unpin + fmt::Debug,
F: FnOnce(DeflateStream<T>) -> S,
{
let Self {
mut conn,
unsolicited_responses_tx,
Expand All @@ -1343,8 +1345,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {

if true {
let deflate_stream = DeflateStream::new(stream);
/*
let stream = ImapStream::new(deflate_stream);
let stream = ImapStream::new(f(deflate_stream));
let conn = Connection {
stream,
request_ids: IdGenerator::new(),
Expand All @@ -1354,8 +1355,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {
unsolicited_responses_tx,
unsolicited_responses,
};
*/
Ok(Ok(deflate_stream))
Ok(Ok(session))
} else {
let stream = ImapStream::new(stream);
let conn = Connection {
Expand Down

0 comments on commit 823b791

Please sign in to comment.