Skip to content

Commit 07ba81b

Browse files
fix Sync and Send trait
1 parent 43f8d34 commit 07ba81b

33 files changed

+80
-75
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "docan"
3-
version = "0.1.0-b2"
3+
version = "0.1.0-b4"
44
edition = "2021"
55
license = "MIT OR LGPL-3.0"
66
authors = ["Jesse Smith <[email protected]>"]
@@ -32,20 +32,20 @@ async-trait = "0.1"
3232
bytes = "1.10"
3333
hex = "0.4"
3434
log = "0.4"
35-
rs-can = "0.3.0"
35+
rs-can = { version = "0.3.1" }
3636
rsutil = { version = "0.1", features = ["log", "types"] }
3737
thiserror = "2"
3838
tokio = { version = "1", features = ["time", "fs"] }
3939

4040
[dependencies.iso14229-1]
4141
#path = "../iso-std-rs/iso14229-1"
42-
version = "0.1.0-b3"
42+
version = "0.1.0-b4"
4343
default-features = false
4444
optional = true
4545

4646
[dependencies.iso15765-2 ]
4747
#path = "../iso-std-rs/iso15765-2"
48-
version = "0.1.0-b3"
48+
version = "0.1.0-b4"
4949
default-features = false
5050

5151
[dependencies.rand]
@@ -64,6 +64,6 @@ optional = true
6464
anyhow = "1"
6565
futures = "0.3"
6666
scopeguard = "1.2"
67-
socketcan-rs = { version = "0.3.0" }
67+
socketcan-rs = { version = "0.3.0", path = "../rust-can/socketcan" }
6868
tokio = { version = "1.40.0", features = ["macros", "rt-multi-thread", "signal"] }
6969
tokio-stream = "0.1"

src/client/client_impl/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@ use std::{fmt::Display, hash::Hash};
1717
#[derive(Clone)]
1818
pub struct DoCanClient<D, C, F>
1919
where
20-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
21-
C: Display + Clone + Hash + Eq + Send + Sync + 'static,
22-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
20+
D: CanDevice<Channel = C, Frame = F> + Clone + 'static,
21+
C: Display + Clone + Hash + Eq + 'static,
22+
F: CanFrame<Channel = C> + Clone + Display + 'static,
2323
{
2424
isotp: CanIsoTp<D, C, F>,
2525
context: Context,
2626
}
2727
unsafe impl<D, C, F> Send for DoCanClient<D, C, F>
2828
where
29-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
30-
C: Display + Clone + Hash + Eq + Send + Sync + 'static,
31-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
29+
D: CanDevice<Channel = C, Frame = F> + Clone + 'static,
30+
C: Display + Clone + Hash + Eq + 'static,
31+
F: CanFrame<Channel = C> + Clone + Display + 'static,
3232
{
3333
}
3434
unsafe impl<D, C, F> Sync for DoCanClient<D, C, F>
3535
where
3636
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
37-
C: Display + Clone + Hash + Eq + Send + Sync + 'static,
38-
F: CanFrame<Channel = C> + Clone + Send + Display + 'static,
37+
C: Display + Clone + Hash + Eq + Send + 'static,
38+
F: CanFrame<Channel = C> + Clone + Display + 'static,
3939
{
4040
}
4141

4242
impl<D, C, F> DoCanClient<D, C, F>
4343
where
4444
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
4545
C: Display + Clone + Hash + Eq + Send + Sync + 'static,
46-
F: CanFrame<Channel = C> + Clone + Send + Display + 'static,
46+
F: CanFrame<Channel = C> + Clone + Display + 'static,
4747
{
4848
pub async fn new(
4949
device: D,

src/client/client_impl/trait_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use tokio::time::sleep;
1717
#[async_trait::async_trait]
1818
impl<D, C, F> Client for DoCanClient<D, C, F>
1919
where
20-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
20+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
2121
C: Display + Clone + Hash + Eq + Send + Sync + 'static,
22-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
22+
F: CanFrame<Channel = C> + Clone + Display + 'static,
2323
{
2424
async fn update_address(&self, address: Address) {
2525
self.isotp.update_address(address).await;

src/server/context.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub(crate) struct Context {
1919
pub(crate) did_dyn: Arc<Mutex<HashMap<DataIdentifier, Bytes>>>,
2020
pub(crate) sa_algo: Arc<Mutex<Option<SecurityAlgo>>>,
2121
pub(crate) sa_ctx: Arc<Mutex<Option<(u8, Bytes)>>>,
22+
#[allow(dead_code)]
2223
pub(crate) memories: Arc<Mutex<HashMap<MemoryLocation, Bytes>>>,
2324
pub(crate) session: SessionManager,
2425
}
@@ -85,6 +86,7 @@ impl Context {
8586
self.config.did_sa_level.get(did).cloned()
8687
}
8788

89+
#[allow(unused)]
8890
#[inline(always)]
8991
pub async fn set_dynamic_did<T: AsRef<[u8]>>(&mut self, did: &DataIdentifier, data: T) -> bool {
9092
match self.config.did_cfg.get(did) {
@@ -104,6 +106,7 @@ impl Context {
104106
}
105107
}
106108

109+
#[allow(unused)]
107110
#[inline(always)]
108111
pub async fn get_dynamic_did(&self, did: &DataIdentifier) -> Option<Bytes> {
109112
self.did_get_util(self.did_dyn.lock().await, &did)
@@ -146,5 +149,6 @@ impl Context {
146149
}
147150
}
148151

152+
#[allow(unused)]
149153
pub(crate) async fn clear_diagnostic_info(&self, info: ClearDiagnosticInfo) {}
150154
}

src/server/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ where
3030
Ok(res)
3131
}
3232

33+
#[allow(unused)]
3334
#[derive(Debug, Clone, Deserialize)]
3435
pub struct Config {
3536
pub(crate) address: Address,

src/server/server_impl/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ pub struct DoCanServer<D, C, F> {
2828

2929
impl<D, C, F> DoCanServer<D, C, F>
3030
where
31-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
31+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
3232
C: Clone + Eq + Display + Send + Sync + 'static,
33-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
33+
F: CanFrame<Channel = C> + Clone + Display + 'static,
3434
{
3535
pub async fn new(device: D, channel: C) -> Result<Self, DoCanError> {
3636
let context = context::Context::new().await?;
@@ -220,9 +220,9 @@ where
220220
#[async_trait::async_trait]
221221
impl<D, C, F> Server for DoCanServer<D, C, F>
222222
where
223-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
223+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
224224
C: Clone + Eq + Display + Send + Sync + 'static,
225-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
225+
F: CanFrame<Channel = C> + Clone + Display + 'static,
226226
{
227227
#[inline(always)]
228228
async fn update_address(&self, address: Address) {

src/server/server_impl/service/access_timing_param.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use std::fmt::Display;
1111

1212
impl<D, C, F> DoCanServer<D, C, F>
1313
where
14-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
15-
C: Clone + Eq + Display + Send + Sync + 'static,
16-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
14+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
15+
C: Clone + Eq + Display + Send + 'static,
16+
F: CanFrame<Channel = C> + Clone + Display + 'static,
1717
{
1818
pub(crate) async fn access_timing_param(
1919
&self,

src/server/server_impl/service/authentication.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use std::fmt::Display;
1111

1212
impl<D, C, F> DoCanServer<D, C, F>
1313
where
14-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
14+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
1515
C: Clone + Eq + Display + Send + Sync + 'static,
16-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
16+
F: CanFrame<Channel = C> + Clone + Display + 'static,
1717
{
1818
pub(crate) async fn authentication(
1919
&self,

src/server/server_impl/service/clear_diagnostic_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use std::fmt::Display;
1111

1212
impl<D, C, F> DoCanServer<D, C, F>
1313
where
14-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
14+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
1515
C: Clone + Eq + Display + Send + Sync + 'static,
16-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
16+
F: CanFrame<Channel = C> + Clone + Display + 'static,
1717
{
1818
pub(crate) async fn clear_diagnostic_info(
1919
&self,

src/server/server_impl/service/communication_ctrl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use std::fmt::Display;
1111

1212
impl<D, C, F> DoCanServer<D, C, F>
1313
where
14-
D: CanDevice<Channel = C, Frame = F> + Clone + Send + Sync + 'static,
14+
D: CanDevice<Channel = C, Frame = F> + Clone + Send + 'static,
1515
C: Clone + Eq + Display + Send + Sync + 'static,
16-
F: CanFrame<Channel = C> + Clone + Display + Send + Sync + 'static,
16+
F: CanFrame<Channel = C> + Clone + Display + 'static,
1717
{
1818
pub(crate) async fn communication_ctrl(
1919
&self,

0 commit comments

Comments
 (0)