Skip to content

Commit 60589b1

Browse files
committed
React to review comments
- consistent ordering of struct defs in examples - attributes for ContextType enum
1 parent 1cad709 commit 60589b1

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

examples/http_auth_random.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn _start() {
2323
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpAuthRandomRoot) });
2424
}
2525

26-
struct HttpAuthRandom;
2726
struct HttpAuthRandomRoot;
2827

2928
impl Context for HttpAuthRandomRoot {}
@@ -38,6 +37,8 @@ impl RootContext for HttpAuthRandomRoot {
3837
}
3938
}
4039

40+
struct HttpAuthRandom;
41+
4142
impl Context for HttpAuthRandom {
4243
fn on_http_call_response(&mut self, _: u32, _: usize, body_size: usize, _: usize) {
4344
if let Some(body) = self.get_http_call_response_body(0, body_size) {

examples/http_body.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub fn _start() {
2121
proxy_wasm::set_root_context(|_| -> Box<dyn RootContext> { Box::new(HttpBodyRoot) });
2222
}
2323

24-
struct HttpBody;
2524
struct HttpBodyRoot;
2625

2726
impl Context for HttpBodyRoot {}
@@ -36,6 +35,8 @@ impl RootContext for HttpBodyRoot {
3635
}
3736
}
3837

38+
struct HttpBody;
39+
3940
impl Context for HttpBody {}
4041

4142
impl HttpContext for HttpBody {

src/types.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ pub enum Status {
4747
InternalFailure = 10,
4848
}
4949

50+
#[repr(u32)]
51+
#[derive(Debug)]
52+
pub enum ContextType {
53+
RootContext = 0,
54+
HttpContext = 1,
55+
StreamContext = 2,
56+
}
57+
5058
#[repr(u32)]
5159
#[derive(Debug)]
5260
pub enum BufferType {
@@ -85,9 +93,3 @@ pub enum MetricType {
8593
}
8694

8795
pub type Bytes = Vec<u8>;
88-
89-
pub enum ContextType {
90-
RootContext = 0,
91-
HttpContext = 1,
92-
StreamContext = 2,
93-
}

0 commit comments

Comments
 (0)