-
Notifications
You must be signed in to change notification settings - Fork 2
[CPP-78][CPP-79]Navbar + TCP / File comms, disconnect, pause #32
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
Conversation
…aelburke/tcp_serial
…connectrequest deconstruction.
6cc5226
to
7ec30a2
Compare
7ec30a2
to
a29b1d6
Compare
…aelburke/tcp_serial
console_backend/src/solution_tab.rs
Outdated
pub struct SolutionTab { | ||
pub age_corrections: Option<f64>, | ||
pub available_units: [&'static str; 2], | ||
pub client_sender: Box<dyn MessageSender>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there is some use case for swapping different sender types at runtime I think just making the struct generic is better -
pub struct SolutionTab<S: MessageSender> {
pub client_sender: S,
...
}
I think this might solve the 'static issue as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Worked beautifully!!
e31a1f3
to
b7a87ce
Compare
console_backend/src/types.rs
Outdated
|
||
#[derive(Clone)] | ||
use std::fmt::Debug; | ||
impl Debug for dyn MessageSender { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you have Debug
and Clone
be supertraits of MessageSender
like
trait MessageSender: Debug + Clone {
...
}
you can avoid this impl and the + Clone
(in one of the tab constructors). Assuming it makes sense to require the sender to be both of those, which seems reasonable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
if shared_state.is_paused() { | ||
loop { | ||
if !shared_state.is_paused() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a busy loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it was. I added a 100 ms sleep.
8db7e68
to
cbd8a20
Compare
Backend
Frontend
Still need to include delays for files, serial connections, and the refresh rate toggle but I figured itd be better to get this in first.