@@ -131,9 +131,9 @@ pub trait Context {
131
131
///
132
132
/// If `num_headers` is 0, then the HTTP call failed.
133
133
///
134
- /// All headers can be retrieved using `self.get_http_response_headers ()` or individually `self.get_http_response_header (name)`.
134
+ /// All headers can be retrieved using `self.get_http_call_response_headers ()` or individually `self.get_http_call_response_header (name)`.
135
135
///
136
- /// All trailers can be retrieved using `self.get_http_response_trailers ()` or individually `self.get_http_response_trailer (name)`.
136
+ /// All trailers can be retrieved using `self.get_http_call_response_trailers ()` or individually `self.get_http_call_response_trailer (name)`.
137
137
///
138
138
/// # Arguments
139
139
///
@@ -365,11 +365,13 @@ pub trait RootContext: Context {
365
365
/// serde_json::from_slice::<MyVmConfiguration>(&vm_configuration).unwrap();
366
366
///
367
367
/// // Do something with the parsed vm configuration
368
- /// debug!("vm_configuration: {:?}", parsed_vm_configuration)
368
+ /// debug!("vm_configuration: {:?}", parsed_vm_configuration);
369
369
///
370
370
/// true
371
371
/// }
372
372
/// }
373
+ ///
374
+ /// # impl Context for MyRootContext {}
373
375
/// ```
374
376
fn on_vm_start ( & mut self , _vm_configuration_size : usize ) -> bool {
375
377
true
@@ -404,11 +406,13 @@ pub trait RootContext: Context {
404
406
/// serde_json::from_slice::<MyVmConfiguration>(&vm_configuration).unwrap();
405
407
///
406
408
/// // Do something with the parsed vm configuration
407
- /// debug!("vm_configuration: {:?}", parsed_vm_configuration)
409
+ /// debug!("vm_configuration: {:?}", parsed_vm_configuration);
408
410
///
409
411
/// true
410
412
/// }
411
413
/// }
414
+ ///
415
+ /// # impl Context for MyRootContext {}
412
416
/// ```
413
417
fn get_vm_configuration ( & self ) -> Option < Bytes > {
414
418
hostcalls:: get_buffer ( BufferType :: VmConfiguration , 0 , usize:: MAX ) . unwrap ( )
@@ -448,11 +452,13 @@ pub trait RootContext: Context {
448
452
/// serde_json::from_slice::<MyPluginConfiguration>(&plugin_configuration).unwrap();
449
453
///
450
454
/// // Do something with the parsed plugin configuration
451
- /// debug!("plugin_configuration: {:?}", parsed_plugin_configuration)
455
+ /// debug!("plugin_configuration: {:?}", parsed_plugin_configuration);
452
456
///
453
457
/// true
454
458
/// }
455
459
/// }
460
+ ///
461
+ /// # impl Context for MyRootContext {}
456
462
/// ```
457
463
fn on_configure ( & mut self , _plugin_configuration_size : usize ) -> bool {
458
464
true
@@ -487,11 +493,13 @@ pub trait RootContext: Context {
487
493
/// serde_json::from_slice::<MyPluginConfiguration>(&plugin_configuration).unwrap();
488
494
///
489
495
/// // Do something with the parsed plugin configuration
490
- /// debug!("plugin_configuration: {:?}", parsed_plugin_configuration)
496
+ /// debug!("plugin_configuration: {:?}", parsed_plugin_configuration);
491
497
///
492
498
/// true
493
499
/// }
494
500
/// }
501
+ ///
502
+ /// # impl Context for MyRootContext {}
495
503
/// ```
496
504
fn get_plugin_configuration ( & self ) -> Option < Bytes > {
497
505
hostcalls:: get_buffer ( BufferType :: PluginConfiguration , 0 , usize:: MAX ) . unwrap ( )
@@ -525,6 +533,8 @@ pub trait RootContext: Context {
525
533
/// info!("tick!")
526
534
/// }
527
535
/// }
536
+ ///
537
+ /// # impl Context for MyRootContext {}
528
538
/// ```
529
539
fn set_tick_period ( & self , period : Duration ) {
530
540
hostcalls:: set_tick_period ( period) . unwrap ( )
@@ -556,6 +566,8 @@ pub trait RootContext: Context {
556
566
/// info!("tick!")
557
567
/// }
558
568
/// }
569
+ ///
570
+ /// # impl Context for MyRootContext {}
559
571
/// ```
560
572
fn on_tick ( & mut self ) { }
561
573
@@ -671,6 +683,8 @@ pub trait HttpContext: Context {
671
683
/// Action::Continue
672
684
/// }
673
685
/// }
686
+ ///
687
+ /// # impl Context for MyPlugin {}
674
688
/// ```
675
689
fn on_http_request_headers ( & mut self , _num_headers : usize , _end_of_stream : bool ) -> Action {
676
690
Action :: Continue
@@ -702,6 +716,8 @@ pub trait HttpContext: Context {
702
716
/// Action::Continue
703
717
/// }
704
718
/// }
719
+ ///
720
+ /// # impl Context for MyPlugin {}
705
721
/// ```
706
722
fn get_http_request_headers ( & self ) -> Vec < ( String , String ) > {
707
723
hostcalls:: get_map ( MapType :: HttpRequestHeaders ) . unwrap ( )
@@ -732,7 +748,7 @@ pub trait HttpContext: Context {
732
748
/// # Example
733
749
///
734
750
/// ```rust
735
- /// use proxy_wasm::traits:*;
751
+ /// use proxy_wasm::traits:: *;
736
752
/// use proxy_wasm::types::*;
737
753
/// use log::debug;
738
754
///
@@ -749,6 +765,8 @@ pub trait HttpContext: Context {
749
765
/// Action::Continue
750
766
/// }
751
767
/// }
768
+ ///
769
+ /// # impl Context for MyPlugin {}
752
770
/// ```
753
771
fn get_http_request_header ( & self , name : & str ) -> Option < String > {
754
772
hostcalls:: get_map_value ( MapType :: HttpRequestHeaders , name) . unwrap ( )
@@ -788,6 +806,8 @@ pub trait HttpContext: Context {
788
806
/// Action::Continue
789
807
/// }
790
808
/// }
809
+ ///
810
+ /// # impl Context for MyPlugin {}
791
811
/// ```
792
812
fn add_http_request_header ( & self , name : & str , value : & str ) {
793
813
hostcalls:: add_map_value ( MapType :: HttpRequestHeaders , name, value) . unwrap ( )
@@ -1004,6 +1024,8 @@ pub trait HttpContext: Context {
1004
1024
/// Action::Pause
1005
1025
/// }
1006
1026
/// }
1027
+ ///
1028
+ /// # impl Context for MyPlugin {}
1007
1029
/// ```
1008
1030
fn send_http_response (
1009
1031
& self ,
0 commit comments