Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support core::fmt::Write on UARTs #33

Open
thejpster opened this issue Feb 1, 2020 · 1 comment
Open

Support core::fmt::Write on UARTs #33

thejpster opened this issue Feb 1, 2020 · 1 comment

Comments

@thejpster
Copy link

I've found it useful in the past if the UART object implements core::fmt::Write. This would mean you can write:

let serial = Serial(...);
writeln!(serial, "Hello, {}!", name).unwrap();

I tried doing my own impl in my application, but as I've defined neither the core::fmt::Write trait, nor the Serial object, the compiler won't let me (even with the changes that went into 1.41).

@ctron
Copy link
Contributor

ctron commented Sep 17, 2020

I just found out, it does work with Tx:

let serial = Serial::new(...);
let (tx, rx) = serial.split();
writeln!(tx, "Hello, {}!", name).unwrap();

Wouldn't that be enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants