Skip to content

Commit

Permalink
make it Rust idiomatic (ehem...)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Apr 8, 2024
1 parent 7248b72 commit f77cea1
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions rust/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,13 @@ impl ListenInfo {
.as_ref()
.map(|address| address.to_string()),
port: self.port.unwrap_or(0),
port_range: Box::new(transport::PortRange {
min: if self.port_range.is_some() {
*self.port_range.as_ref().unwrap().start()
} else {
0
},
max: if self.port_range.is_some() {
*self.port_range.as_ref().unwrap().end()
} else {
0
},
}),
port_range: match &self.port_range {
Some(port_range) => Box::new(transport::PortRange {
min: *port_range.start(),
max: *port_range.end(),
}),
None => Box::new(transport::PortRange { min: 0, max: 0 }),
},
flags: Box::new(self.flags.unwrap_or_default().to_fbs()),
send_buffer_size: self.send_buffer_size.unwrap_or(0),
recv_buffer_size: self.recv_buffer_size.unwrap_or(0),
Expand Down

0 comments on commit f77cea1

Please sign in to comment.