@@ -355,6 +355,28 @@ impl MySqlConnectOptions {
355355 /// Uses a prebuilt rustls config for TLS when the `rustls` feature is enabled.
356356 ///
357357 /// This overrides any CA/cert/key set via the other SSL helpers.
358+ ///
359+ /// # Example
360+ ///
361+ /// ```rust,no_run
362+ /// # #[cfg(feature = "rustls")]
363+ /// # {
364+ /// use sqlx_mysql::MySqlConnectOptions;
365+ ///
366+ /// let Some(provider) = rustls::crypto::CryptoProvider::get_default().cloned() else {
367+ /// return;
368+ /// };
369+ /// let config = rustls::ClientConfig::builder_with_provider(provider)
370+ /// .with_safe_default_protocol_versions()
371+ /// .unwrap()
372+ /// .with_root_certificates(rustls::RootCertStore::empty())
373+ /// .with_no_client_auth();
374+ ///
375+ /// let _options = MySqlConnectOptions::new()
376+ /// .ssl_rustls_config(config)
377+ /// .tls_server_name("db.example.com");
378+ /// # }
379+ /// ```
358380 #[ cfg( feature = "rustls" ) ]
359381 pub fn ssl_rustls_config ( mut self , config : rustls:: ClientConfig ) -> Self {
360382 self . ssl_config = SslConfig :: Rustls ( Box :: new ( config) ) ;
@@ -364,6 +386,15 @@ impl MySqlConnectOptions {
364386 /// Overrides the TLS server name used for SNI and hostname verification.
365387 ///
366388 /// By default, the host from `MySqlConnectOptions` is used.
389+ ///
390+ /// # Example
391+ ///
392+ /// ```rust
393+ /// # use sqlx_mysql::MySqlConnectOptions;
394+ /// let _options = MySqlConnectOptions::new()
395+ /// .host("haproxy.example.com")
396+ /// .tls_server_name("mysql.example.com");
397+ /// ```
367398 pub fn tls_server_name ( mut self , server_name : & str ) -> Self {
368399 self . tls_server_name = Some ( server_name. to_owned ( ) ) ;
369400 self
0 commit comments