@@ -21,18 +21,18 @@ pub trait Packet: Marshal + Unmarshal + fmt::Display + fmt::Debug {
2121 fn destination_ssrc ( & self ) -> Vec < u32 > ;
2222 fn raw_size ( & self ) -> usize ;
2323 fn as_any ( & self ) -> & dyn Any ;
24- fn equal ( & self , other : & dyn Packet ) -> bool ;
25- fn cloned ( & self ) -> Box < dyn Packet > ;
24+ fn equal ( & self , other : & ( dyn Packet + Send + Sync ) ) -> bool ;
25+ fn cloned ( & self ) -> Box < dyn Packet + Send + Sync > ;
2626}
2727
28- impl PartialEq for dyn Packet {
28+ impl PartialEq for dyn Packet + Send + Sync {
2929 fn eq ( & self , other : & Self ) -> bool {
3030 self . equal ( other)
3131 }
3232}
3333
34- impl Clone for Box < dyn Packet > {
35- fn clone ( & self ) -> Box < dyn Packet > {
34+ impl Clone for Box < dyn Packet + Send + Sync > {
35+ fn clone ( & self ) -> Box < dyn Packet + Send + Sync > {
3636 self . cloned ( )
3737 }
3838}
@@ -43,7 +43,7 @@ impl Clone for Box<dyn Packet> {
4343/// If this is a reduced-size RTCP packet a feedback packet (Goodbye, SliceLossIndication, etc)
4444/// will be returned. Otherwise, the underlying type of the returned packet will be
4545/// CompoundPacket.
46- pub fn unmarshal < B > ( raw_data : & mut B ) -> Result < Box < dyn Packet > >
46+ pub fn unmarshal < B > ( raw_data : & mut B ) -> Result < Box < dyn Packet + Send + Sync > >
4747where
4848 B : Buf ,
4949{
6868
6969/// unmarshaller is a factory which pulls the first RTCP packet from a bytestream,
7070/// and returns it's parsed representation, and the amount of data that was processed.
71- pub ( crate ) fn unmarshaller < B > ( raw_data : & mut B ) -> Result < Box < dyn Packet > >
71+ pub ( crate ) fn unmarshaller < B > ( raw_data : & mut B ) -> Result < Box < dyn Packet + Send + Sync > >
7272where
7373 B : Buf ,
7474{
8181
8282 let mut in_packet = h. marshal ( ) ?. chain ( raw_data. take ( length) ) ;
8383
84- let p: Box < dyn Packet > = match h. packet_type {
84+ let p: Box < dyn Packet + Send + Sync > = match h. packet_type {
8585 PacketType :: SenderReport => Box :: new ( SenderReport :: unmarshal ( & mut in_packet) ?) ,
8686 PacketType :: ReceiverReport => Box :: new ( ReceiverReport :: unmarshal ( & mut in_packet) ?) ,
8787 PacketType :: SourceDescription => Box :: new ( SourceDescription :: unmarshal ( & mut in_packet) ?) ,
@@ -185,7 +185,7 @@ mod test {
185185 media_ssrc : 0x902f9e2e ,
186186 } ;
187187
188- let expected: Box < dyn Packet > = Box :: new ( CompoundPacket ( vec ! [
188+ let expected: Box < dyn Packet + Send + Sync > = Box :: new ( CompoundPacket ( vec ! [
189189 Box :: new( a) ,
190190 Box :: new( b) ,
191191 Box :: new( c) ,
0 commit comments