File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,20 @@ pub enum EndpointScope {
13
13
ChangeOwners ,
14
14
}
15
15
16
+ impl From < & EndpointScope > for & [ u8 ] {
17
+ fn from ( scope : & EndpointScope ) -> Self {
18
+ match scope {
19
+ EndpointScope :: PublishNew => b"publish-new" ,
20
+ EndpointScope :: PublishUpdate => b"publish-update" ,
21
+ EndpointScope :: Yank => b"yank" ,
22
+ EndpointScope :: ChangeOwners => b"change-owners" ,
23
+ }
24
+ }
25
+ }
26
+
16
27
impl ToSql < Text , Pg > for EndpointScope {
17
28
fn to_sql < W : Write > ( & self , out : & mut Output < ' _ , W , Pg > ) -> serialize:: Result {
18
- match * self {
19
- EndpointScope :: PublishNew => out. write_all ( b"publish-new" ) ?,
20
- EndpointScope :: PublishUpdate => out. write_all ( b"publish-update" ) ?,
21
- EndpointScope :: Yank => out. write_all ( b"yank" ) ?,
22
- EndpointScope :: ChangeOwners => out. write_all ( b"change-owners" ) ?,
23
- }
29
+ out. write_all ( self . into ( ) ) ?;
24
30
Ok ( IsNull :: No )
25
31
}
26
32
}
You can’t perform that action at this time.
0 commit comments