We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a166193 commit 962e3aeCopy full SHA for 962e3ae
src/server.rs
@@ -322,6 +322,24 @@ where
322
&self.state
323
}
324
325
+ /// Stops the server when given `stop_token` completes.
326
+ ///
327
+ /// # Example
328
329
+ /// ```rust
330
+ /// use tide::cancellation::StopSource;
331
332
+ /// let mut app = tide::new();
333
334
+ /// let stop_source = StopSource::new();
335
336
+ /// app.stop_on(stop_source.token());
337
338
+ /// // Runs server...
339
340
+ /// // When something happens
341
+ /// drop(stop_source);
342
+ /// ```
343
pub fn stop_on(&mut self, stop_token: StopToken) -> &mut Self {
344
self.stop_token = stop_token;
345
self
0 commit comments