You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the way the data types are for rust-imap you must know the exact type of connection you will be using and which tls implementation you are going to use in order to define your types.
I would like to make a PR that abstracts that all away into an enum so that it is hidden from the user.
A user should be able to do something like this.
letmut builder = ClientBuilder::new(self.config.imap_host.as_ref().unwrap(),self.config.imap_port,);if use_starttls {// tag that we want start tls
builder.starttls();}elseif use_ssl {// tag that we are doing FULL ssl mode
builder.ssl();}// otherwise we are doing RAW tcp (still valid as it is useful for internal only connections)// connects and returns an opaque ImapClient that abstracts away the Tcp stream type)let client :ImapClient = builder.connect()?;// connects and returns an opaque ImapSession that abstracts away the Tcp stream type)let session :ImapSession = client.login("user","pass")?;
Other crates do this and it greatly simplifies client-code as I don't have to know how I compiled the code in order to connect. And I can choose to conditionally connect via SSL / TLS / raw.
One example is ldap3, which uses a simple ENUM to differentiate between Tcp, Tls, and Unix sockets (imap would only need the 2).
Let me know if you are open to this and I can build up a PR.
The text was updated successfully, but these errors were encountered:
Currently the way the data types are for rust-imap you must know the exact type of connection you will be using and which tls implementation you are going to use in order to define your types.
I would like to make a PR that abstracts that all away into an enum so that it is hidden from the user.
A user should be able to do something like this.
Other crates do this and it greatly simplifies client-code as I don't have to know how I compiled the code in order to connect. And I can choose to conditionally connect via SSL / TLS / raw.
One example is ldap3, which uses a simple ENUM to differentiate between Tcp, Tls, and Unix sockets (imap would only need the 2).
Let me know if you are open to this and I can build up a PR.
The text was updated successfully, but these errors were encountered: