chatmail / chatmail/async-imap

Writing code generic over client type?

Open
#18 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
147
Forks
42
Avg merge
8d 15h
Merged PRs (30d)
1

Description

Currently `Client` is parametrized over the `Read + Write + fmt::Debug` types. Unfortunately, because this is a requirement of three non-marker traits, it does not seem possible to write code which is agnostic to the specific kind of the underlying stream by using a trait object like `Box`.

My use case is that I need to write some code which works with IMAP servers, but depending on configuration those servers can be TLS or non-TLS. As of now, it does not seem possible to handle such servers in a uniform way.

I'm frankly not sure how, but it would be great if the library supported some kind of a way to write code which does not depend on the connection details of a particular client and would allow working with any of them. I guess the most straightforward way to do it would be to extract the public interface of the `Client` and `Session` structs to traits, but given that traits can't have async method now, it might be hard to do...

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the public Client and Session structs and how their Read, Write, and fmt::Debug bounds are used. Investigate a uniform abstraction for TLS and non-TLS IMAP connections, then define completion around client code being usable without depending on the underlying stream type. The issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.