Skip to content

Commit f8683e4

Browse files
committed
docs: Use result of WebhookServer::new
1 parent a3b3cc1 commit f8683e4

File tree

1 file changed

+15
-3
lines changed
  • crates/stackable-webhook/src

1 file changed

+15
-3
lines changed

crates/stackable-webhook/src/lib.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
//! use stackable_webhook::{WebhookServer, Options};
1212
//! use axum::Router;
1313
//!
14+
//! # async fn test() {
1415
//! let router = Router::new();
15-
//! let server = WebhookServer::new(router, Options::default());
16+
//! let (server, cert_rx) = WebhookServer::new(router, Options::default())
17+
//! .await
18+
//! .expect("failed to create WebhookServer");
19+
//! # }
1620
//! ```
1721
//!
1822
//! For some usages, complete end-to-end [`WebhookServer`] implementations
@@ -98,8 +102,12 @@ impl WebhookServer {
98102
/// use stackable_webhook::{WebhookServer, Options};
99103
/// use axum::Router;
100104
///
105+
/// # async fn test() {
101106
/// let router = Router::new();
102-
/// let server = WebhookServer::new(router, Options::default());
107+
/// let (server, cert_rx) = WebhookServer::new(router, Options::default())
108+
/// .await
109+
/// .expect("failed to create WebhookServer");
110+
/// # }
103111
/// ```
104112
///
105113
/// ### Example with Custom Options
@@ -108,13 +116,17 @@ impl WebhookServer {
108116
/// use stackable_webhook::{WebhookServer, Options};
109117
/// use axum::Router;
110118
///
119+
/// # async fn test() {
111120
/// let options = Options::builder()
112121
/// .bind_address([127, 0, 0, 1], 8080)
113122
/// .add_subject_alterative_dns_name("my-san-entry")
114123
/// .build();
115124
///
116125
/// let router = Router::new();
117-
/// let server = WebhookServer::new(router, options);
126+
/// let (server, cert_rx) = WebhookServer::new(router, options)
127+
/// .await
128+
/// .expect("failed to create WebhookServer");
129+
/// # }
118130
/// ```
119131
pub async fn new(
120132
router: Router,

0 commit comments

Comments
 (0)