Skip to content

Commit d930635

Browse files
committed
Add Client module to cfu-service
This module defines the CfuClient traits and implements them for a mock instance
1 parent 241a3d3 commit d930635

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

cfu-service/src/client.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use embedded_cfu_protocol::components::{CfuComponentTraits, PrimaryCfuComponent};
2+
pub use embedded_cfu_protocol::{CfuReceiveContent, CfuReceiverStates};
3+
4+
pub trait CfuClient<T, C, RT: Default, E: Default>:
5+
CfuReceiveContent<T, C, RT, E> + CfuReceiverStates<T, C, RT, E>
6+
{
7+
}
8+
9+
pub struct CfuClientInstanceMock<C: CfuComponentTraits> {
10+
pub primary_cmpt: PrimaryCfuComponent<C>,
11+
}
12+
13+
// use default implementations
14+
impl<T, C, RT: Default, E: Default, C2: CfuComponentTraits> CfuReceiveContent<T, C, RT, E>
15+
for CfuClientInstanceMock<C2>
16+
{
17+
}
18+
impl<T, C, RT: Default, E: Default, C2: CfuComponentTraits> CfuReceiverStates<T, C, RT, E>
19+
for CfuClientInstanceMock<C2>
20+
{
21+
}
22+
impl<T, C, RT: Default, E: Default, C2: CfuComponentTraits> CfuClient<T, C, RT, E> for CfuClientInstanceMock<C2> {}

cfu-service/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![no_std]
22
use embedded_cfu_protocol::protocol_definitions::CfuProtocolError;
33

4+
pub mod client;
45
pub mod host;
56

67
pub enum CfuError {

0 commit comments

Comments
 (0)