Skip to content

Commit f737ec6

Browse files
committed
chore(lints): fix future_not_send warnings
1 parent 9de372e commit f737ec6

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

‎src/backend/dimse/association/mod.rs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use dicom::ul::pdu::PresentationContextNegotiated;
22
use dicom::ul::Pdu;
3+
use std::future::Future;
34
use std::time::Duration;
45
use thiserror::Error;
56
use tokio::sync::mpsc::Sender;
@@ -22,9 +23,16 @@ pub enum AssociationError {
2223
}
2324

2425
pub trait Association {
25-
async fn receive(&self, timeout: Duration) -> Result<Pdu, AssociationError>;
26+
fn receive(
27+
&self,
28+
timeout: Duration,
29+
) -> impl Future<Output = Result<Pdu, AssociationError>> + Send;
2630

27-
async fn send(&self, pdu: Pdu, timeout: Duration) -> Result<(), AssociationError>;
31+
fn send(
32+
&self,
33+
pdu: Pdu,
34+
timeout: Duration,
35+
) -> impl Future<Output = Result<(), AssociationError>> + Send;
2836

2937
fn close(&mut self);
3038

‎src/backend/dimse/mod.rs‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use dicom::transfer_syntax::TransferSyntaxRegistry;
3030
use dicom::ul::pdu::{PDataValue, PDataValueType};
3131
use dicom::ul::Pdu;
3232
use std::fmt::{Debug, Formatter};
33+
use std::future::Future;
3334
use std::sync::atomic::{AtomicU16, Ordering};
3435
use std::time::Duration;
3536
use thiserror::Error;
@@ -105,23 +106,26 @@ impl TryFrom<u16> for StatusType {
105106
}
106107

107108
pub 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

111115
pub 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();

‎src/main.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::multiple_crate_versions)]
2+
13
pub(crate) mod api;
24
pub(crate) mod backend;
35
pub(crate) mod config;

0 commit comments

Comments
 (0)