Skip to content

Commit d279d1a

Browse files
committed
Make SerialPort::new() unsafe
1 parent ebea054 commit d279d1a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ pub struct SerialPort {
3838
}
3939

4040
impl SerialPort {
41-
pub const fn new(base: u16) -> SerialPort {
41+
/// Creates a new serial port interface on the given I/O port.
42+
///
43+
/// This function is unsafe because the caller must ensure that the given base address
44+
/// really points to a serial port device.
45+
pub const unsafe fn new(base: u16) -> SerialPort {
4246
SerialPort {
4347
data: Port::new(base),
4448
int_en: Port::new(base + 1),

0 commit comments

Comments
 (0)