rust-osdev / uart_16550

Minimal support for uart_16550 serial output.
MIT License
33 stars 25 forks source link

error[E0599]: no method named `init` found for unit type `()` in the current scope #20

Closed 404Dev-404 closed 2 years ago

404Dev-404 commented 3 years ago

I tried following the test part of the Rust OSDev Tutorial but when i try using serial_port.init(); I get this error.

error[E0599]: no method named `init` found for unit type `()` in the current scope --> src/serial.rs:9:21 | 9 | serial_port.init(); | ^^^^ method not found in `()`

I am using uart_16550 version 0.2.0 I don't know if this is the right place.

phil-opp commented 2 years ago

Looks like you did not create the serial_port variable in the right way, as it seems to be of type ()? Maybe you have an accidental semicolon somewhere, e.g.:

let mut serial_port = unsafe {
    SerialPort::new(SERIAL_IO_PORT); // remove this `;`, otherwise the result type is `()` 
};

I don't know if this is the right place.

Asking here is fine!


I think this should solve your issue, so I'm going to close this issue. If you still have problems, let us know!