diff --git a/rodbus/examples/custom_server.rs b/rodbus/examples/custom_server.rs index 899e43df..43d52292 100644 --- a/rodbus/examples/custom_server.rs +++ b/rodbus/examples/custom_server.rs @@ -78,7 +78,7 @@ impl RequestHandler for SimpleHandler { } } - fn process_cfc_69(&mut self, values: &CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_69(&mut self, values: CustomFunctionCode) -> Result, ExceptionCode> { tracing::info!("processing custom function code: {}", values.function_code()); // increment each CFC value by 1 and return the result // Create a new vector to hold the incremented values diff --git a/rodbus/src/client/channel.rs b/rodbus/src/client/channel.rs index c47f5bf8..5509f412 100644 --- a/rodbus/src/client/channel.rs +++ b/rodbus/src/client/channel.rs @@ -169,8 +169,8 @@ impl Channel { pub async fn send_custom_function_code( &mut self, param: RequestParam, - request: CustomFunctionCode, - ) -> Result, RequestError> { + request: CustomFunctionCode, + ) -> Result { let (tx, rx) = tokio::sync::oneshot::channel::, RequestError>>(); let request = wrap( param, diff --git a/rodbus/src/client/message.rs b/rodbus/src/client/message.rs index 91ac61d2..43ef934b 100644 --- a/rodbus/src/client/message.rs +++ b/rodbus/src/client/message.rs @@ -46,7 +46,7 @@ pub(crate) enum RequestDetails { WriteSingleRegister(SingleWrite>), WriteMultipleCoils(MultipleWriteRequest), WriteMultipleRegisters(MultipleWriteRequest), - SendCustomFunctionCode(CustomFCRequest>), + SendCustomFunctionCode(CustomFCRequest), } impl Request { diff --git a/rodbus/src/client/requests/send_custom_fc.rs b/rodbus/src/client/requests/send_custom_fc.rs index c51aa22e..50ef9d45 100644 --- a/rodbus/src/client/requests/send_custom_fc.rs +++ b/rodbus/src/client/requests/send_custom_fc.rs @@ -66,7 +66,7 @@ where } } -impl CustomFCOperation for CustomFunctionCode { +impl CustomFCOperation for CustomFunctionCode { fn serialize(&self, cursor: &mut WriteCursor) -> Result<(), RequestError> { cursor.write_u8(self.function_code())?; diff --git a/rodbus/src/common/parse.rs b/rodbus/src/common/parse.rs index 89baa648..c8a69712 100644 --- a/rodbus/src/common/parse.rs +++ b/rodbus/src/common/parse.rs @@ -28,7 +28,7 @@ impl Parse for Indexed { } } -impl Parse for CustomFunctionCode { +impl Parse for CustomFunctionCode { fn parse(cursor: &mut ReadCursor) -> Result { let fc = cursor.read_u8()?; let len = cursor.remaining() / 2; diff --git a/rodbus/src/common/serialize.rs b/rodbus/src/common/serialize.rs index c7572d13..8da1530c 100644 --- a/rodbus/src/common/serialize.rs +++ b/rodbus/src/common/serialize.rs @@ -290,7 +290,7 @@ impl Serialize for WriteMultiple { } } -impl Serialize for &CustomFunctionCode { +impl Serialize for CustomFunctionCode { fn serialize(&self, cursor: &mut WriteCursor) -> Result<(), RequestError> { cursor.write_u8(self.function_code())?; @@ -301,7 +301,7 @@ impl Serialize for &CustomFunctionCode { } } -impl Loggable for &CustomFunctionCode { +impl Loggable for CustomFunctionCode { fn log( &self, payload: &[u8], @@ -353,7 +353,7 @@ mod tests { #[test] fn serialize_succeeds_for_valid_cfc_of_single_min_value() { - let custom_fc = &CustomFunctionCode::new(1, vec![0x0000]); + let custom_fc = CustomFunctionCode::new(1, vec![0x0000]); let mut buffer = [0u8; 4]; let mut cursor = WriteCursor::new(&mut buffer); custom_fc.serialize(&mut cursor).unwrap(); @@ -362,7 +362,7 @@ mod tests { #[test] fn serialize_succeeds_for_valid_cfc_of_single_max_value() { - let custom_fc = &CustomFunctionCode::new(1, vec![0xFFFF]); + let custom_fc = CustomFunctionCode::new(1, vec![0xFFFF]); let mut buffer = [0u8; 4]; let mut cursor = WriteCursor::new(&mut buffer); custom_fc.serialize(&mut cursor).unwrap(); @@ -371,7 +371,7 @@ mod tests { #[test] fn serialize_succeeds_for_valid_cfc_of_multiple_min_values() { - let custom_fc = &CustomFunctionCode::new(3, vec![0x0000, 0x0000, 0x0000]); + let custom_fc = CustomFunctionCode::new(3, vec![0x0000, 0x0000, 0x0000]); let mut buffer = [0u8; 8]; let mut cursor = WriteCursor::new(&mut buffer); custom_fc.serialize(&mut cursor).unwrap(); @@ -380,7 +380,7 @@ mod tests { #[test] fn serialize_succeeds_for_valid_cfc_of_multiple_max_values() { - let custom_fc = &CustomFunctionCode::new(3, vec![0xFFFF, 0xFFFF, 0xFFFF]); + let custom_fc = CustomFunctionCode::new(3, vec![0xFFFF, 0xFFFF, 0xFFFF]); let mut buffer = [0u8; 8]; let mut cursor = WriteCursor::new(&mut buffer); custom_fc.serialize(&mut cursor).unwrap(); diff --git a/rodbus/src/server/handler.rs b/rodbus/src/server/handler.rs index 338eb570..772b7a32 100644 --- a/rodbus/src/server/handler.rs +++ b/rodbus/src/server/handler.rs @@ -64,97 +64,97 @@ pub trait RequestHandler: Send + 'static { } /// Write the CFC65 custom function code - fn process_cfc_65(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_65(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC66 custom function code - fn process_cfc_66(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_66(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC67 custom function code - fn process_cfc_67(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_67(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC68 custom function code - fn process_cfc_68(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_68(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC69 custom function code - fn process_cfc_69(&mut self, _values: &CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_69(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC70 custom function code - fn process_cfc_70(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_70(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC71 custom function code - fn process_cfc_71(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_71(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC72 custom function code - fn process_cfc_72(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_72(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC100 custom function code - fn process_cfc_100(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_100(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC7101 custom function code - fn process_cfc_101(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_101(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC102 custom function code - fn process_cfc_102(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_102(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC103 custom function code - fn process_cfc_103(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_103(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC104 custom function code - fn process_cfc_104(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_104(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC105 custom function code - fn process_cfc_105(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_105(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC106 custom function code - fn process_cfc_106(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_106(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC107 custom function code - fn process_cfc_107(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_107(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC108 custom function code - fn process_cfc_108(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_108(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC109 custom function code - fn process_cfc_109(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_109(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } /// Write the CFC110 custom function code - fn process_cfc_110(&mut self, _values: CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_110(&mut self, _values: CustomFunctionCode) -> Result { Err(ExceptionCode::IllegalFunction) } } @@ -323,97 +323,97 @@ pub trait AuthorizationHandler: Send + Sync + 'static { } /// Authorize a Send CFC65 request - fn process_cfc_65(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_65(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC66 request - fn process_cfc_66(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_66(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC67 request - fn process_cfc_67(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_67(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC68 request - fn process_cfc_68(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_68(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC69 request - fn process_cfc_69(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_69(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC70 request - fn process_cfc_70(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_70(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC71 request - fn process_cfc_71(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_71(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC72 request - fn process_cfc_72(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_72(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC100 request - fn process_cfc_100(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_100(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC101 request - fn process_cfc_101(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_101(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC102 request - fn process_cfc_102(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_102(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC103 request - fn process_cfc_103(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_103(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC104 request - fn process_cfc_104(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_104(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC105 request - fn process_cfc_105(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_105(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC106 request - fn process_cfc_106(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_106(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC107 request - fn process_cfc_107(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_107(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC108 request - fn process_cfc_108(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_108(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC109 request - fn process_cfc_109(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_109(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } /// Authorize a Send CFC110 request - fn process_cfc_110(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_110(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Deny } } @@ -496,97 +496,97 @@ impl AuthorizationHandler for ReadOnlyAuthorizationHandler { } /// Authorize a Send CFC65 request - fn process_cfc_65(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_65(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC66 request - fn process_cfc_66(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_66(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC67 request - fn process_cfc_67(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_67(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC68 request - fn process_cfc_68(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_68(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC69 request - fn process_cfc_69(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_69(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC70 request - fn process_cfc_70(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_70(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC71 request - fn process_cfc_71(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_71(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC72 request - fn process_cfc_72(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_72(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC100 request - fn process_cfc_100(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_100(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC101 request - fn process_cfc_101(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_101(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC102 request - fn process_cfc_102(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_102(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC103 request - fn process_cfc_103(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_103(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC104 request - fn process_cfc_104(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_104(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC105 request - fn process_cfc_105(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_105(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC106 request - fn process_cfc_106(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_106(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC107 request - fn process_cfc_107(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_107(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC108 request - fn process_cfc_108(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_108(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC109 request - fn process_cfc_109(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_109(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } /// Authorize a Send CFC110 request - fn process_cfc_110(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { + fn process_cfc_110(&self, _unit_id: UnitId, _value: CustomFunctionCode, _role: &str) -> Authorization { Authorization::Allow } } @@ -624,7 +624,7 @@ mod tests { ); assert_eq!( - handler.process_cfc_69(&CustomFunctionCode::new(0x45, vec![0x01, 0x02, 0x03, 0x04])), + handler.process_cfc_69(CustomFunctionCode::new(0x45, vec![0x01, 0x02, 0x03, 0x04])), Err(ExceptionCode::IllegalFunction) ); assert_eq!( diff --git a/rodbus/src/server/request.rs b/rodbus/src/server/request.rs index 8ae90405..3bb53772 100644 --- a/rodbus/src/server/request.rs +++ b/rodbus/src/server/request.rs @@ -21,7 +21,7 @@ pub(crate) enum Request<'a> { WriteSingleRegister(Indexed), WriteMultipleCoils(WriteCoils<'a>), WriteMultipleRegisters(WriteRegisters<'a>), - SendCustomFunctionCode(CustomFunctionCode), + SendCustomFunctionCode(CustomFunctionCode), } /// All requests that support broadcast diff --git a/rodbus/src/types.rs b/rodbus/src/types.rs index 42706202..d230bf8c 100644 --- a/rodbus/src/types.rs +++ b/rodbus/src/types.rs @@ -86,10 +86,10 @@ pub(crate) struct RegisterIteratorDisplay<'a> { } /// Custom Function Code -#[derive(Clone, Debug, PartialEq)] -pub struct CustomFunctionCode { +#[derive(Clone, Debug, Copy, PartialEq)] +pub struct CustomFunctionCode{ fc: u8, - data: Vec, + data: Vec, } impl std::fmt::Display for UnitId { @@ -374,7 +374,7 @@ impl Default for UnitId { } } -impl CustomFunctionCode { +impl CustomFunctionCode { /// Create a new custom function code pub fn new(fc: u8, data: Vec) -> Self { Self { fc, data } @@ -396,7 +396,7 @@ impl CustomFunctionCode { } } -impl std::fmt::Display for CustomFunctionCode { +impl std::fmt::Display for CustomFunctionCode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "values: [")?; for (i, val) in self.data.iter().enumerate() { diff --git a/rodbus/tests/integration_test.rs b/rodbus/tests/integration_test.rs index 3260451f..a79c898d 100644 --- a/rodbus/tests/integration_test.rs +++ b/rodbus/tests/integration_test.rs @@ -95,7 +95,7 @@ impl RequestHandler for Handler { Ok(()) } - fn process_cfc_69(&mut self, values: &CustomFunctionCode) -> Result, ExceptionCode> { + fn process_cfc_69(&mut self, values: CustomFunctionCode) -> Result, ExceptionCode> { tracing::info!("processing custom function code: {}, data: {:?}", values.function_code(), values.iter()); // increment each CFC value by 1 and return the result let incremented_values = values.iter().map(|&x| x + 1).collect();