Skip to content

Commit 9a0cf90

Browse files
committed
Remove PortReadWrite trait, which is no longer needed
1 parent cbf0cb2 commit 9a0cf90

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

Changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `interrupts::enable_interrupts_and_hlt`
1212
- **Breaking:** Make `DescriptorTablePointer::base` a `VirtAddr` ([#215](https://github.com/rust-osdev/x86_64/pull/215))
1313
- **Breaking:** Change return type of `read_rip` to `VirtAddr` ([#216](https://github.com/rust-osdev/x86_64/pull/216))
14+
- **Breaking:** Remove `PortReadWrite` trait, which is no longer needed ([#217](https://github.com/rust-osdev/x86_64/pull/217))
1415
- Relaxe `Sized` requirement for `FrameAllocator` in `Mapper::map_to` ([204](https://github.com/rust-osdev/x86_64/pull/204))
1516

1617
# 0.12.3 – 2020-10-31

src/instructions/port.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use core::marker::PhantomData;
44

5-
pub use crate::structures::port::{PortRead, PortReadWrite, PortWrite};
5+
pub use crate::structures::port::{PortRead, PortWrite};
66

77
impl PortRead for u8 {
88
#[cfg(feature = "inline_asm")]
@@ -94,10 +94,6 @@ impl PortWrite for u32 {
9494
}
9595
}
9696

97-
impl PortReadWrite for u8 {}
98-
impl PortReadWrite for u16 {}
99-
impl PortReadWrite for u32 {}
100-
10197
/// A read only I/O port.
10298
#[derive(Debug, Clone, PartialEq, Eq)]
10399
pub struct PortReadOnly<T> {
@@ -178,7 +174,7 @@ impl<T> Port<T> {
178174
}
179175
}
180176

181-
impl<T: PortReadWrite> Port<T> {
177+
impl<T: PortRead> Port<T> {
182178
/// Reads from the port.
183179
///
184180
/// ## Safety
@@ -189,7 +185,9 @@ impl<T: PortReadWrite> Port<T> {
189185
pub unsafe fn read(&mut self) -> T {
190186
T::read_from_port(self.port)
191187
}
188+
}
192189

190+
impl<T: PortWrite> Port<T> {
193191
/// Writes to the port.
194192
///
195193
/// ## Safety

src/structures/port.rs

-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,3 @@ pub trait PortWrite {
2727
/// safety.
2828
unsafe fn write_to_port(port: u16, value: Self);
2929
}
30-
31-
/// A helper trait that implements the read/write port operations.
32-
///
33-
/// On x86, I/O ports operate on either `u8` (via `inb`/`outb`), `u16` (via `inw`/`outw`),
34-
/// or `u32` (via `inl`/`outl`). Therefore this trait is implemented for exactly these types.
35-
pub trait PortReadWrite: PortRead + PortWrite {}

0 commit comments

Comments
 (0)