Skip to content

Commit fd96bc2

Browse files
bors[bot]fooker
andauthored
Merge #34
34: Implement AsRawFd for Spidev r=eldruin a=fooker Implement `AsRawFd` for `Spidev` to allow access to the underlying file descriptor. This enables usage in async code. Co-authored-by: Dustin Frisch <[email protected]>
2 parents f257420 + af07f7d commit fd96bc2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ impl Write for Spidev {
277277
}
278278
}
279279

280+
impl AsRawFd for Spidev {
281+
fn as_raw_fd(&self) -> RawFd {
282+
self.devfile.as_raw_fd()
283+
}
284+
}
285+
280286
#[cfg(test)]
281287
mod test {
282288
use super::{SpiModeFlags, SpidevOptions};

0 commit comments

Comments
 (0)