11//! Blocking SPI API
22
33/// Blocking transfer with separate buffers
4- pub trait Transfer < W = u8 > {
4+ pub trait Transfer < W : Copy = u8 > {
55 /// Error type
66 type Error : crate :: spi:: Error ;
77
@@ -16,7 +16,7 @@ pub trait Transfer<W = u8> {
1616 fn transfer ( & mut self , read : & mut [ W ] , write : & [ W ] ) -> Result < ( ) , Self :: Error > ;
1717}
1818
19- impl < T : Transfer < W > , W > Transfer < W > for & mut T {
19+ impl < T : Transfer < W > , W : Copy > Transfer < W > for & mut T {
2020 type Error = T :: Error ;
2121
2222 fn transfer ( & mut self , read : & mut [ W ] , write : & [ W ] ) -> Result < ( ) , Self :: Error > {
@@ -25,7 +25,7 @@ impl<T: Transfer<W>, W> Transfer<W> for &mut T {
2525}
2626
2727/// Blocking transfer with single buffer (in-place)
28- pub trait TransferInplace < W = u8 > {
28+ pub trait TransferInplace < W : Copy = u8 > {
2929 /// Error type
3030 type Error : crate :: spi:: Error ;
3131
@@ -35,7 +35,7 @@ pub trait TransferInplace<W = u8> {
3535 fn transfer_inplace ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > ;
3636}
3737
38- impl < T : TransferInplace < W > , W > TransferInplace < W > for & mut T {
38+ impl < T : TransferInplace < W > , W : Copy > TransferInplace < W > for & mut T {
3939 type Error = T :: Error ;
4040
4141 fn transfer_inplace ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > {
@@ -44,7 +44,7 @@ impl<T: TransferInplace<W>, W> TransferInplace<W> for &mut T {
4444}
4545
4646/// Blocking read
47- pub trait Read < W = u8 > {
47+ pub trait Read < W : Copy = u8 > {
4848 /// Error type
4949 type Error : crate :: spi:: Error ;
5050
@@ -55,7 +55,7 @@ pub trait Read<W = u8> {
5555 fn read ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > ;
5656}
5757
58- impl < T : Read < W > , W > Read < W > for & mut T {
58+ impl < T : Read < W > , W : Copy > Read < W > for & mut T {
5959 type Error = T :: Error ;
6060
6161 fn read ( & mut self , words : & mut [ W ] ) -> Result < ( ) , Self :: Error > {
@@ -64,15 +64,15 @@ impl<T: Read<W>, W> Read<W> for &mut T {
6464}
6565
6666/// Blocking write
67- pub trait Write < W = u8 > {
67+ pub trait Write < W : Copy = u8 > {
6868 /// Error type
6969 type Error : crate :: spi:: Error ;
7070
7171 /// Writes `words` to the slave, ignoring all the incoming words
7272 fn write ( & mut self , words : & [ W ] ) -> Result < ( ) , Self :: Error > ;
7373}
7474
75- impl < T : Write < W > , W > Write < W > for & mut T {
75+ impl < T : Write < W > , W : Copy > Write < W > for & mut T {
7676 type Error = T :: Error ;
7777
7878 fn write ( & mut self , words : & [ W ] ) -> Result < ( ) , Self :: Error > {
@@ -81,7 +81,7 @@ impl<T: Write<W>, W> Write<W> for &mut T {
8181}
8282
8383/// Blocking write (iterator version)
84- pub trait WriteIter < W = u8 > {
84+ pub trait WriteIter < W : Copy = u8 > {
8585 /// Error type
8686 type Error : crate :: spi:: Error ;
8787
@@ -91,7 +91,7 @@ pub trait WriteIter<W = u8> {
9191 WI : IntoIterator < Item = W > ;
9292}
9393
94- impl < T : WriteIter < W > , W > WriteIter < W > for & mut T {
94+ impl < T : WriteIter < W > , W : Copy > WriteIter < W > for & mut T {
9595 type Error = T :: Error ;
9696
9797 fn write_iter < WI > ( & mut self , words : WI ) -> Result < ( ) , Self :: Error >
@@ -106,7 +106,7 @@ impl<T: WriteIter<W>, W> WriteIter<W> for &mut T {
106106///
107107/// This allows composition of SPI operations into a single bus transaction
108108#[ derive( Debug , PartialEq ) ]
109- pub enum Operation < ' a , W : ' static = u8 > {
109+ pub enum Operation < ' a , W : ' static + Copy = u8 > {
110110 /// Read data into the provided buffer.
111111 Read ( & ' a mut [ W ] ) ,
112112 /// Write data from the provided buffer, discarding read data
@@ -119,15 +119,15 @@ pub enum Operation<'a, W: 'static = u8> {
119119
120120/// Transactional trait allows multiple actions to be executed
121121/// as part of a single SPI transaction
122- pub trait Transactional < W : ' static = u8 > {
122+ pub trait Transactional < W : ' static + Copy = u8 > {
123123 /// Associated error type
124124 type Error : crate :: spi:: Error ;
125125
126126 /// Execute the provided transactions
127127 fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > ;
128128}
129129
130- impl < T : Transactional < W > , W : ' static > Transactional < W > for & mut T {
130+ impl < T : Transactional < W > , W : ' static + Copy > Transactional < W > for & mut T {
131131 type Error = T :: Error ;
132132
133133 fn exec < ' a > ( & mut self , operations : & mut [ Operation < ' a , W > ] ) -> Result < ( ) , Self :: Error > {
0 commit comments