docs: add missing doc(cfg(...)) attributes (#1085)
This commit is contained in:
@@ -163,6 +163,7 @@ impl Envelope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "builder")]
|
#[cfg(feature = "builder")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "builder")))]
|
||||||
impl TryFrom<&Headers> for Envelope {
|
impl TryFrom<&Headers> for Envelope {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ impl Error {
|
|||||||
|
|
||||||
/// Returns true if the error is an envelope serialization or deserialization error
|
/// Returns true if the error is an envelope serialization or deserialization error
|
||||||
#[cfg(feature = "file-transport-envelope")]
|
#[cfg(feature = "file-transport-envelope")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "file-transport-envelope")))]
|
||||||
pub fn is_envelope(&self) -> bool {
|
pub fn is_envelope(&self) -> bool {
|
||||||
matches!(self.inner.kind, Kind::Envelope)
|
matches!(self.inner.kind, Kind::Envelope)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ impl FileTransport {
|
|||||||
/// Writes the email content in eml format and the envelope
|
/// Writes the email content in eml format and the envelope
|
||||||
/// in json format.
|
/// in json format.
|
||||||
#[cfg(feature = "file-transport-envelope")]
|
#[cfg(feature = "file-transport-envelope")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "file-transport-envelope")))]
|
||||||
pub fn with_envelope<P: AsRef<Path>>(path: P) -> FileTransport {
|
pub fn with_envelope<P: AsRef<Path>>(path: P) -> FileTransport {
|
||||||
FileTransport {
|
FileTransport {
|
||||||
path: PathBuf::from(path.as_ref()),
|
path: PathBuf::from(path.as_ref()),
|
||||||
@@ -211,6 +212,7 @@ impl FileTransport {
|
|||||||
///
|
///
|
||||||
/// Reads the envelope and the raw message content.
|
/// Reads the envelope and the raw message content.
|
||||||
#[cfg(feature = "file-transport-envelope")]
|
#[cfg(feature = "file-transport-envelope")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "file-transport-envelope")))]
|
||||||
pub fn read(&self, email_id: &str) -> Result<(Envelope, Vec<u8>), Error> {
|
pub fn read(&self, email_id: &str) -> Result<(Envelope, Vec<u8>), Error> {
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
@@ -249,6 +251,7 @@ where
|
|||||||
/// Writes the email content in eml format and the envelope
|
/// Writes the email content in eml format and the envelope
|
||||||
/// in json format.
|
/// in json format.
|
||||||
#[cfg(feature = "file-transport-envelope")]
|
#[cfg(feature = "file-transport-envelope")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "file-transport-envelope")))]
|
||||||
pub fn with_envelope<P: AsRef<Path>>(path: P) -> Self {
|
pub fn with_envelope<P: AsRef<Path>>(path: P) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: FileTransport::with_envelope(path),
|
inner: FileTransport::with_envelope(path),
|
||||||
@@ -260,6 +263,7 @@ where
|
|||||||
///
|
///
|
||||||
/// Reads the envelope and the raw message content.
|
/// Reads the envelope and the raw message content.
|
||||||
#[cfg(feature = "file-transport-envelope")]
|
#[cfg(feature = "file-transport-envelope")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "file-transport-envelope")))]
|
||||||
pub async fn read(&self, email_id: &str) -> Result<(Envelope, Vec<u8>), Error> {
|
pub async fn read(&self, email_id: &str) -> Result<(Envelope, Vec<u8>), Error> {
|
||||||
let eml_file = self.inner.path.join(format!("{email_id}.eml"));
|
let eml_file = self.inner.path.join(format!("{email_id}.eml"));
|
||||||
let eml = E::fs_read(&eml_file).await.map_err(error::io)?;
|
let eml = E::fs_read(&eml_file).await.map_err(error::io)?;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ impl AsyncSmtpConnection {
|
|||||||
///
|
///
|
||||||
/// Sends EHLO and parses server information
|
/// Sends EHLO and parses server information
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
|
||||||
pub async fn connect_with_transport(
|
pub async fn connect_with_transport(
|
||||||
stream: Box<dyn AsyncTokioStream>,
|
stream: Box<dyn AsyncTokioStream>,
|
||||||
hello_name: &ClientId,
|
hello_name: &ClientId,
|
||||||
@@ -94,6 +95,7 @@ impl AsyncSmtpConnection {
|
|||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
|
||||||
pub async fn connect_tokio1<T: tokio1_crate::net::ToSocketAddrs>(
|
pub async fn connect_tokio1<T: tokio1_crate::net::ToSocketAddrs>(
|
||||||
server: T,
|
server: T,
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
@@ -112,6 +114,7 @@ impl AsyncSmtpConnection {
|
|||||||
///
|
///
|
||||||
/// Sends EHLO and parses server information
|
/// Sends EHLO and parses server information
|
||||||
#[cfg(feature = "async-std1")]
|
#[cfg(feature = "async-std1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "async-std1")))]
|
||||||
pub async fn connect_asyncstd1<T: async_std::net::ToSocketAddrs>(
|
pub async fn connect_asyncstd1<T: async_std::net::ToSocketAddrs>(
|
||||||
server: T,
|
server: T,
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
@@ -376,6 +379,10 @@ impl AsyncSmtpConnection {
|
|||||||
|
|
||||||
/// The X509 certificate of the server (DER encoded)
|
/// The X509 certificate of the server (DER encoded)
|
||||||
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(
|
||||||
|
docsrs,
|
||||||
|
doc(cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls")))
|
||||||
|
)]
|
||||||
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
||||||
self.stream.get_ref().peer_certificate()
|
self.stream.get_ref().peer_certificate()
|
||||||
}
|
}
|
||||||
@@ -392,12 +399,14 @@ impl AsyncSmtpConnection {
|
|||||||
/// as the TLSA records match the leaf or issuer certificates.
|
/// as the TLSA records match the leaf or issuer certificates.
|
||||||
/// It cannot be called on non Boring TLS streams.
|
/// It cannot be called on non Boring TLS streams.
|
||||||
#[cfg(feature = "boring-tls")]
|
#[cfg(feature = "boring-tls")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "boring-tls")))]
|
||||||
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
||||||
self.stream.get_ref().tls_verify_result()
|
self.stream.get_ref().tls_verify_result()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the X509 certificates of the chain (DER encoded)
|
/// All the X509 certificates of the chain (DER encoded)
|
||||||
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(any(feature = "rustls", feature = "boring-tls"))))]
|
||||||
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
||||||
self.stream.get_ref().certificate_chain()
|
self.stream.get_ref().certificate_chain()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,11 +130,13 @@ impl AsyncNetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
|
||||||
pub fn use_existing_tokio1(stream: Box<dyn AsyncTokioStream>) -> AsyncNetworkStream {
|
pub fn use_existing_tokio1(stream: Box<dyn AsyncTokioStream>) -> AsyncNetworkStream {
|
||||||
AsyncNetworkStream::new(InnerAsyncNetworkStream::Tokio1Tcp(stream))
|
AsyncNetworkStream::new(InnerAsyncNetworkStream::Tokio1Tcp(stream))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
|
||||||
pub async fn connect_tokio1<T: Tokio1ToSocketAddrs>(
|
pub async fn connect_tokio1<T: Tokio1ToSocketAddrs>(
|
||||||
server: T,
|
server: T,
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
@@ -201,6 +203,7 @@ impl AsyncNetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "async-std1")]
|
#[cfg(feature = "async-std1")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "async-std1")))]
|
||||||
pub async fn connect_asyncstd1<T: AsyncStd1ToSocketAddrs>(
|
pub async fn connect_asyncstd1<T: AsyncStd1ToSocketAddrs>(
|
||||||
server: T,
|
server: T,
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
@@ -437,6 +440,7 @@ impl AsyncNetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "boring-tls")]
|
#[cfg(feature = "boring-tls")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "boring-tls")))]
|
||||||
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
||||||
match &self.inner {
|
match &self.inner {
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
@@ -460,6 +464,7 @@ impl AsyncNetworkStream {
|
|||||||
InnerAsyncNetworkStream::None => panic!("InnerNetworkStream::None must never be built"),
|
InnerAsyncNetworkStream::None => panic!("InnerNetworkStream::None must never be built"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
||||||
match &self.inner {
|
match &self.inner {
|
||||||
#[cfg(feature = "tokio1")]
|
#[cfg(feature = "tokio1")]
|
||||||
|
|||||||
@@ -300,6 +300,10 @@ impl SmtpConnection {
|
|||||||
|
|
||||||
/// The X509 certificate of the server (DER encoded)
|
/// The X509 certificate of the server (DER encoded)
|
||||||
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(
|
||||||
|
docsrs,
|
||||||
|
doc(cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls")))
|
||||||
|
)]
|
||||||
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
||||||
self.stream.get_ref().peer_certificate()
|
self.stream.get_ref().peer_certificate()
|
||||||
}
|
}
|
||||||
@@ -316,12 +320,14 @@ impl SmtpConnection {
|
|||||||
/// as the TLSA records match the leaf or issuer certificates.
|
/// as the TLSA records match the leaf or issuer certificates.
|
||||||
/// It cannot be called on non Boring TLS streams.
|
/// It cannot be called on non Boring TLS streams.
|
||||||
#[cfg(feature = "boring-tls")]
|
#[cfg(feature = "boring-tls")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "boring-tls")))]
|
||||||
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
||||||
self.stream.get_ref().tls_verify_result()
|
self.stream.get_ref().tls_verify_result()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All the X509 certificates of the chain (DER encoded)
|
/// All the X509 certificates of the chain (DER encoded)
|
||||||
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(any(feature = "rustls", feature = "boring-tls"))))]
|
||||||
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
||||||
self.stream.get_ref().certificate_chain()
|
self.stream.get_ref().certificate_chain()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ impl NetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "boring-tls")]
|
#[cfg(feature = "boring-tls")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "boring-tls")))]
|
||||||
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
pub fn tls_verify_result(&self) -> Result<(), Error> {
|
||||||
match &self.inner {
|
match &self.inner {
|
||||||
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
||||||
@@ -238,6 +239,7 @@ impl NetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(any(feature = "rustls", feature = "boring-tls"))))]
|
||||||
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
pub fn certificate_chain(&self) -> Result<Vec<Vec<u8>>, Error> {
|
||||||
match &self.inner {
|
match &self.inner {
|
||||||
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
||||||
@@ -264,6 +266,10 @@ impl NetworkStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(
|
||||||
|
docsrs,
|
||||||
|
doc(cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls")))
|
||||||
|
)]
|
||||||
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
pub fn peer_certificate(&self) -> Result<Vec<u8>, Error> {
|
||||||
match &self.inner {
|
match &self.inner {
|
||||||
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
InnerNetworkStream::Tcp(_) => Err(error::client("Connection is not encrypted")),
|
||||||
|
|||||||
@@ -242,6 +242,10 @@ impl TlsParametersBuilder {
|
|||||||
///
|
///
|
||||||
/// Defaults to [`Tlsv12`][TlsVersion::Tlsv12].
|
/// Defaults to [`Tlsv12`][TlsVersion::Tlsv12].
|
||||||
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
#[cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls"))]
|
||||||
|
#[cfg_attr(
|
||||||
|
docsrs,
|
||||||
|
doc(cfg(any(feature = "native-tls", feature = "rustls", feature = "boring-tls")))
|
||||||
|
)]
|
||||||
pub fn set_min_tls_version(mut self, min_tls_version: TlsVersion) -> Self {
|
pub fn set_min_tls_version(mut self, min_tls_version: TlsVersion) -> Self {
|
||||||
self.min_tls_version = min_tls_version;
|
self.min_tls_version = min_tls_version;
|
||||||
self
|
self
|
||||||
|
|||||||
Reference in New Issue
Block a user