File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
10
10
* Export ` objc-sys ` as ` ffi ` module.
11
11
* Added common trait impls on ` rc::Owned ` and ` rc::Shared ` (useful in generic
12
12
contexts).
13
+ * Implement ` RefEncode ` for ` runtime::Protocol ` .
13
14
14
15
### Changed
15
16
* Deprecated ` runtime::BOOL ` , ` runtime::YES ` and ` runtime::NO ` . Use the
Original file line number Diff line number Diff line change @@ -472,6 +472,11 @@ impl PartialEq for Protocol {
472
472
}
473
473
}
474
474
475
+ unsafe impl RefEncode for Protocol {
476
+ // Protocol is an object internally
477
+ const ENCODING_REF : Encoding < ' static > = Encoding :: Object ;
478
+ }
479
+
475
480
impl Eq for Protocol { }
476
481
477
482
impl fmt:: Debug for Protocol {
@@ -697,12 +702,16 @@ mod tests {
697
702
698
703
#[ test]
699
704
fn test_encode ( ) {
700
- assert_eq ! ( <& Object >:: ENCODING . to_string( ) , "@" ) ;
701
- assert_eq ! ( <* mut Object >:: ENCODING . to_string( ) , "@" ) ;
702
- assert_eq ! ( <& Class >:: ENCODING . to_string( ) , "#" ) ;
703
- assert_eq ! ( Sel :: ENCODING . to_string( ) , ":" ) ;
704
- assert_eq ! ( Imp :: ENCODING . to_string( ) , "^?" ) ;
705
- assert_eq ! ( <Option <Imp >>:: ENCODING . to_string( ) , "^?" ) ;
705
+ fn assert_enc < T : Encode > ( expected : & str ) {
706
+ assert_eq ! ( & T :: ENCODING . to_string( ) , expected) ;
707
+ }
708
+ assert_enc :: < & Object > ( "@" ) ;
709
+ assert_enc :: < * mut Object > ( "@" ) ;
710
+ assert_enc :: < & Class > ( "#" ) ;
711
+ assert_enc :: < Sel > ( ":" ) ;
712
+ assert_enc :: < Imp > ( "^?" ) ;
713
+ assert_enc :: < Option < Imp > > ( "^?" ) ;
714
+ assert_enc :: < & Protocol > ( "@" ) ;
706
715
}
707
716
708
717
#[ test]
You can’t perform that action at this time.
0 commit comments