Skip to content

Commit f190139

Browse files
update imports in docs & tiny fixes
Signed-off-by: Anton Engelhardt <[email protected]>
1 parent 2d9990a commit f190139

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

src/traits.rs

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub trait Context {
8282
/// ```rust
8383
/// use proxy_wasm::traits::*;
8484
/// use proxy_wasm::types::*;
85-
///
85+
/// use std::time::Duration;
8686
/// use log::warn;
8787
///
8888
/// struct MyPlugin;
@@ -99,7 +99,7 @@ pub trait Context {
9999
/// vec![],
100100
/// Duration::from_secs(5),
101101
/// ) {
102-
/// Ok(_) => Action::Pause,
102+
/// Ok(_) => Action::Continue,
103103
/// Err(e) => {
104104
/// warn!("Failed to dispatch_http_call: {:?}", e);
105105
/// Action::Pause
@@ -150,7 +150,7 @@ pub trait Context {
150150
/// ```rust
151151
/// use proxy_wasm::traits::*;
152152
/// use proxy_wasm::types::*;
153-
///
153+
/// use std::time::Duration;
154154
/// use log::{debug, warn};
155155
///
156156
/// struct MyPlugin;
@@ -167,7 +167,7 @@ pub trait Context {
167167
/// vec![],
168168
/// Duration::from_secs(5),
169169
/// ) {
170-
/// Ok(_) => Action::Pause,
170+
/// Ok(_) => Action::Continue,
171171
/// Err(e) => {
172172
/// warn!("Failed to dispatch_http_call: {:?}", e);
173173
/// Action::Pause
@@ -348,7 +348,10 @@ pub trait RootContext: Context {
348348
/// # Example
349349
///
350350
/// ```rust
351-
/// use proxy_wasm::traits::RootContext;
351+
/// use proxy_wasm::traits::*;
352+
/// use proxy_wasm::types::*;
353+
/// use serde_json;
354+
/// use log::debug;
352355
///
353356
/// struct MyRootContext;
354357
///
@@ -385,7 +388,10 @@ pub trait RootContext: Context {
385388
/// # Example
386389
///
387390
/// ```rust
388-
/// use proxy_wasm::traits::RootContext;
391+
/// use proxy_wasm::traits::*;
392+
/// use proxy_wasm::types::*;
393+
/// use serde_json;
394+
/// use log::debug;
389395
///
390396
/// struct MyRootContext;
391397
///
@@ -427,7 +433,10 @@ pub trait RootContext: Context {
427433
/// # Example
428434
///
429435
/// ```rust
430-
/// use proxy_wasm::traits::RootContext;
436+
/// use proxy_wasm::traits::*;
437+
/// use proxy_wasm::types::*;
438+
/// use serde_json;
439+
/// use log::debug;
431440
///
432441
/// struct MyRootContext;
433442
///
@@ -445,6 +454,7 @@ pub trait RootContext: Context {
445454
/// let parsed_plugin_configuration: MyPluginConfiguration = serde_json::from_slice::<MyPluginConfiguration>(&plugin_configuration).unwrap();
446455
///
447456
/// // Do something with the parsed plugin configuration
457+
/// debug!("plugin_configuration: {:?}", parsed_plugin_configuration)
448458
///
449459
/// true
450460
/// }
@@ -463,7 +473,10 @@ pub trait RootContext: Context {
463473
/// # Example
464474
///
465475
/// ```rust
466-
/// use proxy_wasm::traits::RootContext;
476+
/// use proxy_wasm::traits::*;
477+
/// use proxy_wasm::types::*;
478+
/// use serde_json;
479+
/// use log::debug;
467480
///
468481
/// struct MyRootContext;
469482
///
@@ -481,6 +494,7 @@ pub trait RootContext: Context {
481494
/// let parsed_plugin_configuration: MyPluginConfiguration = serde_json::from_slice::<MyPluginConfiguration>(&plugin_configuration).unwrap();
482495
///
483496
/// // Do something with the parsed plugin configuration
497+
/// debug!("plugin_configuration: {:?}", parsed_plugin_configuration)
484498
///
485499
/// true
486500
/// }
@@ -499,7 +513,8 @@ pub trait RootContext: Context {
499513
/// # Example
500514
///
501515
/// ```rust
502-
/// use proxy_wasm::traits::RootContext;
516+
/// use proxy_wasm::traits::*;
517+
/// use proxy_wasm::types::*;
503518
/// use std::time::Duration;
504519
/// use log::info;
505520
///
@@ -529,7 +544,8 @@ pub trait RootContext: Context {
529544
/// # Example
530545
///
531546
/// ```rust
532-
/// use proxy_wasm::traits::RootContext;
547+
/// use proxy_wasm::traits::*;
548+
/// use proxy_wasm::types::*;
533549
/// use std::time::Duration;
534550
/// use log::info;
535551
///
@@ -723,9 +739,9 @@ pub trait HttpContext: Context {
723739
/// # Example
724740
///
725741
/// ```rust
726-
/// use log::debug;
727742
/// use proxy_wasm::traits:*;
728-
/// use proxy_wasm::types::Action;
743+
/// use proxy_wasm::types::*;
744+
/// use log::debug;
729745
///
730746
/// struct MyPlugin;
731747
///
@@ -768,7 +784,7 @@ pub trait HttpContext: Context {
768784
///
769785
/// ```rust
770786
/// use proxy_wasm::traits::*;
771-
/// use proxy_wasm::types::Action;
787+
/// use proxy_wasm::types::*;
772788
///
773789
/// struct MyPlugin;
774790
///

0 commit comments

Comments
 (0)