@@ -30,6 +30,7 @@ use dicom::transfer_syntax::TransferSyntaxRegistry;
3030use dicom:: ul:: pdu:: { PDataValue , PDataValueType } ;
3131use dicom:: ul:: Pdu ;
3232use std:: fmt:: { Debug , Formatter } ;
33+ use std:: future:: Future ;
3334use std:: sync:: atomic:: { AtomicU16 , Ordering } ;
3435use std:: time:: Duration ;
3536use thiserror:: Error ;
@@ -105,23 +106,26 @@ impl TryFrom<u16> for StatusType {
105106}
106107
107108pub trait DicomMessageReader {
108- async fn read_message ( & self , timeout : Duration ) -> Result < DicomMessage , ReadError > ;
109+ fn read_message (
110+ & self ,
111+ timeout : Duration ,
112+ ) -> impl Future < Output = Result < DicomMessage , ReadError > > + Send ;
109113}
110114
111115pub trait DicomMessageWriter {
112- async fn write_message (
116+ fn write_message (
113117 & self ,
114- message : impl Into < DicomMessage > ,
118+ message : impl Into < DicomMessage > + Send ,
115119 presentation_context_id : Option < u8 > ,
116120 timeout : Duration ,
117- ) -> Result < ( ) , WriteError > ;
121+ ) -> impl Future < Output = Result < ( ) , WriteError > > + Send ;
118122}
119123
120- impl < A : Association > DicomMessageWriter for A {
124+ impl < A : Association + Sync > DicomMessageWriter for A {
121125 #[ instrument( skip_all) ]
122126 async fn write_message (
123127 & self ,
124- message : impl Into < DicomMessage > ,
128+ message : impl Into < DicomMessage > + Send ,
125129 presentation_context_id : Option < u8 > ,
126130 timeout : Duration ,
127131 ) -> Result < ( ) , WriteError > {
@@ -215,7 +219,7 @@ pub enum NegotiationError {
215219 NoPresentationContext ,
216220}
217221
218- impl < A : Association > DicomMessageReader for A {
222+ impl < A : Association + Sync > DicomMessageReader for A {
219223 #[ instrument( skip_all) ]
220224 async fn read_message ( & self , timeout : Duration ) -> Result < DicomMessage , ReadError > {
221225 let mut command_fragments = Vec :: new ( ) ;
0 commit comments