| 1 |
|
| 2 |
|
| 3 |
use alloy_tui::keys::Action; |
| 4 |
use alloy_tui::{ |
| 5 |
AlloyBlock, AlloyList, Cursor, Hint, KeyGroup, Severity, TextField, Theme, binding, hint, text, |
| 6 |
unavailable, |
| 7 |
}; |
| 8 |
use anyhow::Result; |
| 9 |
use ratatui::Frame; |
| 10 |
use ratatui::crossterm::event::{KeyCode, KeyEvent}; |
| 11 |
use ratatui::layout::Rect; |
| 12 |
use ratatui::text::{Line, Span}; |
| 13 |
|
| 14 |
use super::backend::{Backend, actionable, detect}; |
| 15 |
use super::diagnose::{NoWireless, kernel_wireless_iface, no_wireless, wifi_plugin_present}; |
| 16 |
use super::model::{Interface, Kind, Network, State}; |
| 17 |
use crate::cli::{CommandLog, Secret}; |
| 18 |
use crate::shell::{Flow, View, block_title}; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
enum Mode { |
| 34 |
|
| 35 |
Devices, |
| 36 |
|
| 37 |
Networks { |
| 38 |
networks: Vec<Network>, |
| 39 |
cursor: Cursor, |
| 40 |
}, |
| 41 |
|
| 42 |
Passphrase { ssid: String, field: TextField }, |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
impl std::fmt::Debug for Mode { |
| 52 |
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
| 53 |
match self { |
| 54 |
Mode::Devices => f.write_str("Devices"), |
| 55 |
Mode::Networks { networks, .. } => write!(f, "Networks({})", networks.len()), |
| 56 |
Mode::Passphrase { ssid, .. } => write!(f, "Passphrase({ssid}, <redacted>)"), |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
pub(crate) struct NetView { |
| 63 |
backend: Box<dyn Backend>, |
| 64 |
interfaces: Vec<Interface>, |
| 65 |
cursor: Cursor, |
| 66 |
error: Option<String>, |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
wifi: Option<bool>, |
| 71 |
mode: Mode, |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
pending: Option<String>, |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
no_wireless: Option<NoWireless>, |
| 83 |
} |
| 84 |
|
| 85 |
impl NetView { |
| 86 |
pub(crate) fn new(log: &mut CommandLog) -> Self { |
| 87 |
let mut view = Self { |
| 88 |
backend: detect(), |
| 89 |
interfaces: Vec::new(), |
| 90 |
cursor: Cursor::new(), |
| 91 |
error: None, |
| 92 |
wifi: None, |
| 93 |
mode: Mode::Devices, |
| 94 |
pending: None, |
| 95 |
no_wireless: None, |
| 96 |
}; |
| 97 |
view.refresh(log); |
| 98 |
view |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
fn can_scan(&self) -> bool { |
| 109 |
self.wifi.is_some() && self.interfaces.iter().any(|i| i.kind == Kind::Wireless) |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
fn scan(&mut self, log: &mut CommandLog) { |
| 114 |
if self.wifi == Some(false) { |
| 115 |
self.error = Some("wifi radio is off; press w".to_string()); |
| 116 |
return; |
| 117 |
} |
| 118 |
let Some(result) = self.backend.networks(log) else { |
| 119 |
self.error = Some(format!("{} cannot scan", self.backend.name())); |
| 120 |
return; |
| 121 |
}; |
| 122 |
match result { |
| 123 |
Ok(networks) if networks.is_empty() => { |
| 124 |
|
| 125 |
|
| 126 |
self.error = Some("no networks in range".to_string()); |
| 127 |
} |
| 128 |
Ok(networks) => { |
| 129 |
let mut cursor = Cursor::new(); |
| 130 |
cursor.resize(networks.len()); |
| 131 |
self.mode = Mode::Networks { networks, cursor }; |
| 132 |
self.error = None; |
| 133 |
} |
| 134 |
Err(err) => self.error = Some(err.to_string()), |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
fn choose(&mut self) -> Flow { |
| 140 |
let Mode::Networks { networks, cursor } = &self.mode else { |
| 141 |
return Flow::Continue; |
| 142 |
}; |
| 143 |
let Some(network) = cursor.selected().and_then(|index| networks.get(index)) else { |
| 144 |
return Flow::Continue; |
| 145 |
}; |
| 146 |
|
| 147 |
if network.security.is_none() { |
| 148 |
let ssid = network.ssid.clone(); |
| 149 |
return self.join(&ssid, None); |
| 150 |
} |
| 151 |
self.mode = Mode::Passphrase { |
| 152 |
ssid: network.ssid.clone(), |
| 153 |
field: TextField::new(), |
| 154 |
}; |
| 155 |
Flow::Continue |
| 156 |
} |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
fn submit(&mut self) -> Flow { |
| 165 |
let Mode::Passphrase { ssid, field } = &mut self.mode else { |
| 166 |
return Flow::Continue; |
| 167 |
}; |
| 168 |
let ssid = ssid.clone(); |
| 169 |
let secret = Secret::new(field.value().as_bytes().to_vec()); |
| 170 |
field.set(""); |
| 171 |
self.join(&ssid, Some(secret)) |
| 172 |
} |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
fn join(&mut self, ssid: &str, passphrase: Option<Secret>) -> Flow { |
| 186 |
let Some(invocation) = self.backend.join(ssid, passphrase) else { |
| 187 |
self.error = Some(format!("{} cannot join a network", self.backend.name())); |
| 188 |
return Flow::Continue; |
| 189 |
}; |
| 190 |
self.pending = Some(ssid.to_string()); |
| 191 |
Flow::AuthorizeInline(invocation) |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
fn can_connect(&self) -> bool { |
| 197 |
self.selected() |
| 198 |
.is_some_and(|iface| self.backend.connect(iface).is_some()) |
| 199 |
} |
| 200 |
|
| 201 |
fn selected(&self) -> Option<&Interface> { |
| 202 |
self.interfaces.get(self.cursor.selected()?) |
| 203 |
} |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
fn toggle(&mut self, log: &mut CommandLog) { |
| 210 |
let Some(iface) = self.selected().cloned() else { |
| 211 |
return; |
| 212 |
}; |
| 213 |
let invocation = if iface.state == State::Connected { |
| 214 |
self.backend.disconnect(&iface) |
| 215 |
} else { |
| 216 |
self.backend.connect(&iface) |
| 217 |
}; |
| 218 |
|
| 219 |
let Some(invocation) = invocation else { |
| 220 |
|
| 221 |
|
| 222 |
self.error = Some(if actionable(&iface) { |
| 223 |
format!("{} cannot act on {}", self.backend.name(), iface.name) |
| 224 |
} else { |
| 225 |
format!("{} is {}", iface.name, iface.state.label()) |
| 226 |
}); |
| 227 |
return; |
| 228 |
}; |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
if iface.kind == Kind::Wireless && self.wifi == Some(false) { |
| 233 |
self.error = Some("wifi radio is off; press w".to_string()); |
| 234 |
return; |
| 235 |
} |
| 236 |
|
| 237 |
self.finish(invocation.run(log).map(drop), log); |
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
fn toggle_wifi(&mut self, log: &mut CommandLog) { |
| 242 |
let Some(on) = self.wifi else { |
| 243 |
self.error = Some("no wifi radio to switch".to_string()); |
| 244 |
return; |
| 245 |
}; |
| 246 |
let Some(invocation) = self.backend.set_wifi(!on) else { |
| 247 |
self.error = Some(format!("{} cannot switch the radio", self.backend.name())); |
| 248 |
return; |
| 249 |
}; |
| 250 |
self.finish(invocation.run(log).map(drop), log); |
| 251 |
} |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
fn finish(&mut self, result: Result<()>, log: &mut CommandLog) { |
| 260 |
match result { |
| 261 |
Ok(()) => { |
| 262 |
self.error = None; |
| 263 |
log.quiet(|log| self.refresh(log)); |
| 264 |
} |
| 265 |
Err(err) => self.error = Some(err.to_string()), |
| 266 |
} |
| 267 |
} |
| 268 |
|
| 269 |
fn refresh(&mut self, log: &mut CommandLog) { |
| 270 |
match self.backend.list(log) { |
| 271 |
Ok(interfaces) => { |
| 272 |
self.interfaces = interfaces; |
| 273 |
|
| 274 |
|
| 275 |
self.cursor.resize(self.interfaces.len()); |
| 276 |
self.error = None; |
| 277 |
} |
| 278 |
Err(err) => self.error = Some(err.to_string()), |
| 279 |
} |
| 280 |
self.wifi = self.backend.wifi_enabled(log); |
| 281 |
self.no_wireless = no_wireless( |
| 282 |
self.interfaces.iter().any(|i| i.kind == Kind::Wireless), |
| 283 |
self.wifi, |
| 284 |
wifi_plugin_present(), |
| 285 |
kernel_wireless_iface().as_deref(), |
| 286 |
); |
| 287 |
} |
| 288 |
|
| 289 |
fn row<'a>(theme: &Theme, iface: &'a Interface) -> Line<'a> { |
| 290 |
let address = iface |
| 291 |
.addresses |
| 292 |
.first() |
| 293 |
.cloned() |
| 294 |
.or_else(|| iface.connection.clone()) |
| 295 |
.unwrap_or_default(); |
| 296 |
|
| 297 |
Line::from(vec![ |
| 298 |
text::bold(theme, format!("{:<12}", iface.name)), |
| 299 |
text::muted(theme, format!("{:<10}", iface.kind.label())), |
| 300 |
Span::styled( |
| 301 |
format!("{:<14}", iface.state.label()), |
| 302 |
iface.state.severity().style(theme), |
| 303 |
), |
| 304 |
text::secondary(theme, address), |
| 305 |
]) |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
fn network_row<'a>(theme: &Theme, network: &'a Network) -> Line<'a> { |
| 315 |
let security = network.security.clone().unwrap_or_else(|| "open".into()); |
| 316 |
Line::from(vec![ |
| 317 |
text::bold( |
| 318 |
theme, |
| 319 |
format!("{:<3}", if network.in_use { "*" } else { "" }), |
| 320 |
), |
| 321 |
text::primary(theme, format!("{:<32}", network.ssid)), |
| 322 |
text::muted(theme, format!("{:>3}% ", network.signal)), |
| 323 |
Span::styled( |
| 324 |
security, |
| 325 |
if network.security.is_some() { |
| 326 |
Severity::Healthy.style(theme) |
| 327 |
} else { |
| 328 |
Severity::Warn.style(theme) |
| 329 |
}, |
| 330 |
), |
| 331 |
]) |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
fn passphrase_line<'a>(theme: &Theme, field: &TextField) -> Line<'a> { |
| 341 |
let (before, under, after) = field.split(); |
| 342 |
Line::from(vec![ |
| 343 |
text::muted(theme, " passphrase "), |
| 344 |
text::primary(theme, "•".repeat(before.chars().count())), |
| 345 |
Span::styled( |
| 346 |
under.map_or(' ', |_| '•').to_string(), |
| 347 |
Severity::Healthy.style(theme), |
| 348 |
), |
| 349 |
text::primary(theme, "•".repeat(after.chars().count())), |
| 350 |
]) |
| 351 |
} |
| 352 |
} |
| 353 |
|
| 354 |
impl View for NetView { |
| 355 |
fn title(&self) -> String { |
| 356 |
match &self.mode { |
| 357 |
Mode::Devices => format!("network ({})", self.backend.name()), |
| 358 |
Mode::Networks { .. } => format!("networks in range ({})", self.backend.name()), |
| 359 |
Mode::Passphrase { ssid, .. } => format!("join {ssid}"), |
| 360 |
} |
| 361 |
} |
| 362 |
|
| 363 |
fn hints(&self) -> Vec<Hint> { |
| 364 |
match &self.mode { |
| 365 |
Mode::Devices => { |
| 366 |
let mut hints = vec![hint("j/k", "select")]; |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
if self.can_connect() { |
| 371 |
hints.push(hint("s", "connect/disconnect")); |
| 372 |
} |
| 373 |
if self.can_scan() { |
| 374 |
hints.push(hint("n", "join a network")); |
| 375 |
} |
| 376 |
if self.wifi.is_some() { |
| 377 |
hints.push(hint("w", "wifi radio")); |
| 378 |
} |
| 379 |
hints.push(hint("r", "refresh")); |
| 380 |
hints |
| 381 |
} |
| 382 |
Mode::Networks { .. } => vec![ |
| 383 |
hint("j/k", "select"), |
| 384 |
hint("enter", "join"), |
| 385 |
hint("n", "scan again"), |
| 386 |
hint("esc", "back"), |
| 387 |
], |
| 388 |
Mode::Passphrase { .. } => vec![hint("enter", "join"), hint("esc", "back")], |
| 389 |
} |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
fn keys(&self) -> Vec<KeyGroup<'static>> { |
| 400 |
match &self.mode { |
| 401 |
Mode::Devices => { |
| 402 |
let connect = if self.can_connect() { |
| 403 |
binding("s", "connect/disconnect") |
| 404 |
} else { |
| 405 |
unavailable("s", "connect/disconnect", "nothing to connect here") |
| 406 |
}; |
| 407 |
let scan = if self.can_scan() { |
| 408 |
binding("n", "join a network") |
| 409 |
} else { |
| 410 |
unavailable("n", "join a network", "no wifi device") |
| 411 |
}; |
| 412 |
let wifi = if self.wifi.is_some() { |
| 413 |
binding("w", "wifi radio") |
| 414 |
} else { |
| 415 |
unavailable("w", "wifi radio", "no wifi device") |
| 416 |
}; |
| 417 |
vec![KeyGroup::new( |
| 418 |
"this pane", |
| 419 |
vec![ |
| 420 |
binding("j/k", "select"), |
| 421 |
connect, |
| 422 |
scan, |
| 423 |
wifi, |
| 424 |
binding("r", "refresh"), |
| 425 |
], |
| 426 |
)] |
| 427 |
} |
| 428 |
Mode::Networks { .. } => vec![KeyGroup::new( |
| 429 |
"networks in range", |
| 430 |
vec![ |
| 431 |
binding("j/k", "select"), |
| 432 |
binding("enter", "join"), |
| 433 |
binding("n", "scan again"), |
| 434 |
binding("esc", "back to devices"), |
| 435 |
], |
| 436 |
)], |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
Mode::Passphrase { .. } => vec![KeyGroup::new( |
| 441 |
"passphrase", |
| 442 |
vec![ |
| 443 |
binding("enter", "join"), |
| 444 |
binding("esc", "back to the network list"), |
| 445 |
], |
| 446 |
)], |
| 447 |
} |
| 448 |
} |
| 449 |
|
| 450 |
|
| 451 |
fn unanswered(&self) -> &'static [Action] { |
| 452 |
&[Action::NextTab, Action::PrevTab] |
| 453 |
} |
| 454 |
|
| 455 |
fn status(&self) -> Option<(Severity, String)> { |
| 456 |
if let Some(message) = &self.error { |
| 457 |
return Some((Severity::Error, message.clone())); |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
(self.wifi == Some(false)).then(|| (Severity::Warn, "wifi radio off".to_string())) |
| 462 |
} |
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
fn authorized(&mut self, outcome: Result<String>, log: &mut CommandLog) { |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
let ssid = self |
| 476 |
.pending |
| 477 |
.take() |
| 478 |
.unwrap_or_else(|| "the network".to_string()); |
| 479 |
match outcome { |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
Ok(_) => { |
| 486 |
self.mode = Mode::Devices; |
| 487 |
self.error = None; |
| 488 |
log.quiet(|log| self.refresh(log)); |
| 489 |
} |
| 490 |
Err(err) => { |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
self.error = Some(if crate::cli::wants_authentication(&err) { |
| 497 |
format!("joining {ssid} was not authorized") |
| 498 |
} else { |
| 499 |
err.to_string() |
| 500 |
}); |
| 501 |
} |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
fn text_entry(&self) -> bool { |
| 511 |
matches!(self.mode, Mode::Passphrase { .. }) |
| 512 |
} |
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
fn cancel(&mut self) -> Flow { |
| 521 |
match &self.mode { |
| 522 |
Mode::Devices => Flow::Exit, |
| 523 |
Mode::Networks { .. } => { |
| 524 |
self.mode = Mode::Devices; |
| 525 |
self.error = None; |
| 526 |
Flow::Continue |
| 527 |
} |
| 528 |
Mode::Passphrase { .. } => { |
| 529 |
self.mode = Mode::Devices; |
| 530 |
self.error = None; |
| 531 |
Flow::Continue |
| 532 |
} |
| 533 |
} |
| 534 |
} |
| 535 |
|
| 536 |
fn render(&self, frame: &mut Frame, area: Rect, theme: &Theme) { |
| 537 |
let block = AlloyBlock::new(theme) |
| 538 |
.focused(true) |
| 539 |
.build() |
| 540 |
.title(block_title(&self.title())); |
| 541 |
let inner = block.inner(area); |
| 542 |
frame.render_widget(block, area); |
| 543 |
|
| 544 |
match &self.mode { |
| 545 |
Mode::Devices => { |
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
let (list_area, note_area) = match (&self.no_wireless, inner.height) { |
| 551 |
(Some(_), h) if h >= 2 => ( |
| 552 |
Rect { |
| 553 |
height: h - 1, |
| 554 |
..inner |
| 555 |
}, |
| 556 |
Some(Rect { |
| 557 |
y: inner.y + h - 1, |
| 558 |
height: 1, |
| 559 |
..inner |
| 560 |
}), |
| 561 |
), |
| 562 |
_ => (inner, None), |
| 563 |
}; |
| 564 |
if let Some(area) = note_area |
| 565 |
&& let Some(reason) = &self.no_wireless |
| 566 |
{ |
| 567 |
frame.render_widget(Line::from(text::muted(theme, reason.message())), area); |
| 568 |
} |
| 569 |
if self.interfaces.is_empty() { |
| 570 |
frame.render_widget(Line::from(text::muted(theme, "no interfaces")), list_area); |
| 571 |
return; |
| 572 |
} |
| 573 |
let rows: Vec<Line> = self |
| 574 |
.interfaces |
| 575 |
.iter() |
| 576 |
.map(|iface| Self::row(theme, iface)) |
| 577 |
.collect(); |
| 578 |
frame.render_widget( |
| 579 |
AlloyList::new(theme, rows).selected(self.cursor.selected()), |
| 580 |
list_area, |
| 581 |
); |
| 582 |
} |
| 583 |
Mode::Networks { networks, cursor } => { |
| 584 |
let rows: Vec<Line> = networks |
| 585 |
.iter() |
| 586 |
.map(|network| Self::network_row(theme, network)) |
| 587 |
.collect(); |
| 588 |
frame.render_widget( |
| 589 |
AlloyList::new(theme, rows).selected(cursor.selected()), |
| 590 |
inner, |
| 591 |
); |
| 592 |
} |
| 593 |
Mode::Passphrase { ssid, field } => { |
| 594 |
let lines = vec![ |
| 595 |
Line::from(text::muted( |
| 596 |
theme, |
| 597 |
format!("passphrase for {ssid}, then enter"), |
| 598 |
)), |
| 599 |
Line::default(), |
| 600 |
Self::passphrase_line(theme, field), |
| 601 |
]; |
| 602 |
frame.render_widget(ratatui::widgets::Paragraph::new(lines), inner); |
| 603 |
} |
| 604 |
} |
| 605 |
} |
| 606 |
|
| 607 |
fn handle(&mut self, key: KeyEvent, log: &mut CommandLog) -> Flow { |
| 608 |
self.error = None; |
| 609 |
match &mut self.mode { |
| 610 |
Mode::Devices => match key.code { |
| 611 |
KeyCode::Char('j') | KeyCode::Down => self.cursor.next(), |
| 612 |
KeyCode::Char('k') | KeyCode::Up => self.cursor.prev(), |
| 613 |
KeyCode::Char('s') => self.toggle(log), |
| 614 |
KeyCode::Char('n') => self.scan(log), |
| 615 |
KeyCode::Char('w') => self.toggle_wifi(log), |
| 616 |
KeyCode::Char('r') => self.refresh(log), |
| 617 |
_ => {} |
| 618 |
}, |
| 619 |
Mode::Networks { cursor, .. } => match key.code { |
| 620 |
KeyCode::Char('j') | KeyCode::Down => cursor.next(), |
| 621 |
KeyCode::Char('k') | KeyCode::Up => cursor.prev(), |
| 622 |
KeyCode::Enter => return self.choose(), |
| 623 |
KeyCode::Char('n') => self.scan(log), |
| 624 |
_ => {} |
| 625 |
}, |
| 626 |
|
| 627 |
|
| 628 |
Mode::Passphrase { field, .. } => match key.code { |
| 629 |
KeyCode::Char(c) => field.insert(c), |
| 630 |
KeyCode::Backspace => field.backspace(), |
| 631 |
KeyCode::Delete => field.delete(), |
| 632 |
KeyCode::Left => field.left(), |
| 633 |
KeyCode::Right => field.right(), |
| 634 |
KeyCode::Home => field.home(), |
| 635 |
KeyCode::End => field.end(), |
| 636 |
KeyCode::Enter => return self.submit(), |
| 637 |
_ => {} |
| 638 |
}, |
| 639 |
} |
| 640 |
Flow::Continue |
| 641 |
} |
| 642 |
} |
| 643 |
|
| 644 |
#[cfg(test)] |
| 645 |
mod tests; |
| 646 |
|