@@ -4,8 +4,8 @@ use actix_web::web::{Bytes, BytesMut};
4
4
use actix_web:: { web, HttpMessage , HttpRequest } ;
5
5
use cloudevents:: event:: SpecVersion ;
6
6
use cloudevents:: message:: {
7
- BinaryDeserializer , BinarySerializer , Encoding , Error , MessageAttributeValue ,
8
- MessageDeserializer , StructuredDeserializer , StructuredSerializer ,
7
+ BinaryDeserializer , BinarySerializer , Encoding , MessageAttributeValue ,
8
+ MessageDeserializer , StructuredDeserializer , StructuredSerializer , Result
9
9
} ;
10
10
use cloudevents:: { message, Event } ;
11
11
use futures:: StreamExt ;
@@ -27,7 +27,7 @@ impl<'a> BinaryDeserializer for HttpRequestDeserializer<'a> {
27
27
fn deserialize_binary < R : Sized , V : BinarySerializer < R > > (
28
28
self ,
29
29
mut visitor : V ,
30
- ) -> Result < R , Error > {
30
+ ) -> Result < R > {
31
31
if self . encoding ( ) != Encoding :: BINARY {
32
32
return Err ( message:: Error :: WrongEncoding { } ) ;
33
33
}
@@ -36,7 +36,7 @@ impl<'a> BinaryDeserializer for HttpRequestDeserializer<'a> {
36
36
unwrap_optional_header ! ( self . req. headers( ) , headers:: SPEC_VERSION_HEADER ) . unwrap ( ) ?,
37
37
) ?;
38
38
39
- visitor. set_spec_version ( spec_version. clone ( ) ) ?;
39
+ visitor = visitor . set_spec_version ( spec_version. clone ( ) ) ?;
40
40
41
41
let attributes = cloudevents:: event:: spec_version:: ATTRIBUTE_NAMES
42
42
. get ( & spec_version)
@@ -50,20 +50,20 @@ impl<'a> BinaryDeserializer for HttpRequestDeserializer<'a> {
50
50
let name = & hn. as_str ( ) [ "ce-" . len ( ) ..] ;
51
51
52
52
if attributes. contains ( & name) {
53
- visitor. set_attribute (
53
+ visitor = visitor . set_attribute (
54
54
name,
55
55
MessageAttributeValue :: String ( String :: from ( header_value_to_str ! ( hv) ?) ) ,
56
56
) ?
57
57
} else {
58
- visitor. set_extension (
58
+ visitor = visitor . set_extension (
59
59
name,
60
60
MessageAttributeValue :: String ( String :: from ( header_value_to_str ! ( hv) ?) ) ,
61
61
) ?
62
62
}
63
63
}
64
64
65
65
if let Some ( hv) = self . req . headers ( ) . get ( "content-type" ) {
66
- visitor. set_attribute (
66
+ visitor = visitor . set_attribute (
67
67
"datacontenttype" ,
68
68
MessageAttributeValue :: String ( String :: from ( header_value_to_str ! ( hv) ?) ) ,
69
69
) ?
@@ -81,7 +81,7 @@ impl<'a> StructuredDeserializer for HttpRequestDeserializer<'a> {
81
81
fn deserialize_structured < R : Sized , V : StructuredSerializer < R > > (
82
82
self ,
83
83
visitor : V ,
84
- ) -> Result < R , Error > {
84
+ ) -> Result < R > {
85
85
if self . encoding ( ) != Encoding :: STRUCTURED {
86
86
return Err ( message:: Error :: WrongEncoding { } ) ;
87
87
}
@@ -110,7 +110,7 @@ impl<'a> MessageDeserializer for HttpRequestDeserializer<'a> {
110
110
pub async fn request_to_event (
111
111
req : & HttpRequest ,
112
112
mut payload : web:: Payload ,
113
- ) -> Result < Event , actix_web:: error:: Error > {
113
+ ) -> std :: result :: Result < Event , actix_web:: error:: Error > {
114
114
let mut bytes = BytesMut :: new ( ) ;
115
115
while let Some ( item) = payload. next ( ) . await {
116
116
bytes. extend_from_slice ( & item?) ;
0 commit comments