2
2
3
3
use core:: { future:: Future , mem:: MaybeUninit } ;
4
4
5
- /// Async read + write
6
- pub trait ReadWrite < Word : ' static > {
5
+ /// Async transfer
6
+ pub trait Transfer < Word : ' static > {
7
7
/// Error type
8
8
type Error ;
9
9
10
10
/// Associated future for the `transfer` method.
11
- type ReadWriteFuture < ' a > : Future < Output = Result < & ' a [ Word ] , Self :: Error > > + ' a
11
+ type TransferFuture < ' a > : Future < Output = Result < ( ) , Self :: Error > > + ' a
12
12
where
13
13
Self : ' a ;
14
14
15
15
/// Writes `words` to the slave from the `write` buffer. Puts the words returned in the `read` buffer.
16
16
/// This method uses separate `write` and `read` buffers.
17
- fn readwrite < ' a > ( & ' a mut self , write : & ' a [ Word ] , read : & ' a mut [ MaybeUninit < Word > ] ) -> Self :: ReadWriteFuture < ' a > ;
17
+ fn transfer < ' a > ( & ' a mut self , write : & ' a [ Word ] , read : & ' a mut [ MaybeUninit < Word > ] ) -> Self :: TransferFuture < ' a > ;
18
18
}
19
19
20
- /// Async read + write in place.
21
- pub trait ReadWriteInPlace < Word : ' static > {
20
+ /// Async transfer in place.
21
+ pub trait TransferInPlace < Word : ' static > {
22
22
/// Error type
23
23
type Error ;
24
24
25
- /// Associated future for the `transfer ` method.
26
- type ReadWriteInPlaceFuture < ' a > : Future < Output = Result < & ' a [ Word ] , Self :: Error > > + ' a
25
+ /// Associated future for the `transfer_inplace ` method.
26
+ type TransferInPlaceFuture < ' a > : Future < Output = Result < ( ) , Self :: Error > > + ' a
27
27
where
28
28
Self : ' a ;
29
29
30
30
/// Writes `words` to the slave from the `readwrite` buffer and reads words into the same buffer.
31
31
/// This method uses a single `readwrite` buffer.
32
32
///
33
33
/// The returned buffer is the initialized `readwrite` buffer.
34
- fn readwrite_inplace < ' a > ( & ' a mut self , readwrite : & ' a mut [ Word ] ) -> Self :: ReadWriteInPlaceFuture < ' a > ;
34
+ fn transfer_inplace < ' a > ( & ' a mut self , readwrite : & ' a mut [ Word ] ) -> Self :: TransferInPlaceFuture < ' a > ;
35
35
}
36
36
37
37
/// Async write
@@ -54,7 +54,7 @@ pub trait Read<Word: 'static> {
54
54
type Error ;
55
55
56
56
/// Associated future for the `read` method.
57
- type ReadFuture < ' a > : Future < Output = Result < & ' a [ Word ] , Self :: Error > > + ' a
57
+ type ReadFuture < ' a > : Future < Output = Result < ( ) , Self :: Error > > + ' a
58
58
where
59
59
Self : ' a ;
60
60
0 commit comments