@@ -5,13 +5,15 @@ use crate::derive::empty::EmptyCoder;
55use crate :: derive:: map:: { MapDecoder , MapEncoder } ;
66use crate :: derive:: option:: { OptionDecoder , OptionEncoder } ;
77use crate :: derive:: result:: { ResultDecoder , ResultEncoder } ;
8- use crate :: derive:: smart_ptr:: { DerefEncoder , FromDecoder } ;
8+ use crate :: derive:: smart_ptr:: { DerefEncoder , FromDecoder , PinDecoder , PinEncoder } ;
9+ use core:: ops:: Deref ;
910use crate :: derive:: vec:: { VecDecoder , VecEncoder } ;
1011use crate :: derive:: { Decode , Encode } ;
1112use crate :: f32:: { F32Decoder , F32Encoder } ;
1213use crate :: int:: { CheckedIntDecoder , IntDecoder , IntEncoder } ;
1314use crate :: str:: { StrDecoder , StrEncoder } ;
1415use alloc:: collections:: { BTreeMap , BTreeSet , BinaryHeap , LinkedList , VecDeque } ;
16+ use core:: pin:: Pin ;
1517use alloc:: string:: String ;
1618use alloc:: vec:: Vec ;
1719use core:: marker:: PhantomData ;
@@ -111,6 +113,19 @@ impl_smart_ptr!(::alloc::rc::Rc);
111113#[ cfg( target_has_atomic = "ptr" ) ]
112114impl_smart_ptr ! ( :: alloc:: sync:: Arc ) ;
113115
116+ impl < P : Deref + Encode > Encode for Pin < P >
117+ where
118+ P :: Target : Encode ,
119+ {
120+ type Encoder = PinEncoder < P > ;
121+ }
122+ impl < ' a , P : Deref + Decode < ' a > > Decode < ' a > for Pin < P >
123+ where
124+ Pin < P > : From < P > ,
125+ {
126+ type Decoder = PinDecoder < ' a , P > ;
127+ }
128+
114129impl < T : Encode , const N : usize > Encode for [ T ; N ] {
115130 type Encoder = ArrayEncoder < T , N > ;
116131}
0 commit comments