Skip to content

Commit 27ae396

Browse files
committed
refactor: made requested changes
Signed-off-by: addrian-77 <lunguadrian30@gmail.com>
1 parent 5f700d0 commit 27ae396

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[workspace]
66

7-
resolver = "2"
7+
resolver = "3"
88

99
members = [
1010
"tockloader-cli",

tockloader-cli/src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ fn get_channel_args() -> Vec<clap::Arg> {
7171
.collect::<Vec<_>>();
7272

7373
vec![
74+
// TODO(george-cosma): Change default to pconsole when new format is implemented and adopted into tock
7475
arg!(--protocol <PROTOCOL> "Choose between legacy and pconsole protocol")
7576
.default_value("legacy")
7677
.value_parser(["legacy", "pconsole"]),

tockloader-cli/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ fn get_board_settings(user_options: &ArgMatches) -> BoardSettings {
7272
}
7373

7474
fn using_serial(user_options: &ArgMatches) -> bool {
75+
// TODO: refactor this in the future
7576
*user_options.get_one::<bool>("serial").unwrap_or(&false)
7677
|| user_options
7778
.get_one::<String>("protocol")
@@ -139,7 +140,7 @@ async fn main() -> Result<()> {
139140
let protocol = sub_matches
140141
.get_one::<String>("protocol")
141142
.map(String::as_str)
142-
.unwrap_or("legacy");
143+
.unwrap();
143144
match protocol {
144145
"legacy" => {
145146
let conn = open_connection(sub_matches).await?;
@@ -148,7 +149,7 @@ async fn main() -> Result<()> {
148149
TockloaderConnection::Serial(serial_connection) => {
149150
tock_process_console::legacy::run(
150151
serial_connection
151-
.get_stream()
152+
.into_inner_stream()
152153
.expect("Expected board to be connected."),
153154
)
154155
.await;

tockloader-lib/src/connection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl SerialConnection {
117117
port,
118118
}
119119
}
120-
pub fn get_stream(self) -> Option<SerialStream> {
120+
pub fn into_inner_stream(self) -> Option<SerialStream> {
121121
self.stream
122122
}
123123
}

0 commit comments

Comments
 (0)