just panic on broker ip parse failure

This commit is contained in:
Robert Jördens 2021-08-03 08:47:08 +00:00
parent 7902b3cb7d
commit 90583e2048
3 changed files with 2 additions and 19 deletions

View File

@ -47,7 +47,6 @@ use stabilizer::{
DigitalInput0, DigitalInput1, AFE0, AFE1,
},
net::{
self,
data_stream::{FrameGenerator, StreamFormat, StreamTarget},
miniconf::Miniconf,
serde::Deserialize,
@ -200,7 +199,7 @@ const APP: () = {
stabilizer.cycle_counter,
env!("CARGO_BIN_NAME"),
stabilizer.net.mac_address,
net::parse_ipv4(option_env!("BROKER").unwrap_or("10.34.16.10")),
option_env!("BROKER").unwrap_or("10.34.16.10").parse().unwrap(),
);
let generator = network

View File

@ -50,7 +50,6 @@ use stabilizer::{
DigitalInput0, DigitalInput1, AFE0, AFE1,
},
net::{
self,
data_stream::{FrameGenerator, StreamFormat, StreamTarget},
miniconf::Miniconf,
serde::Deserialize,
@ -241,7 +240,7 @@ const APP: () = {
stabilizer.cycle_counter,
env!("CARGO_BIN_NAME"),
stabilizer.net.mac_address,
net::parse_ipv4(option_env!("BROKER").unwrap_or("10.34.16.10")),
option_env!("BROKER").unwrap_or("10.34.16.10").parse().unwrap(),
);
let generator = network.configure_streaming(

View File

@ -208,18 +208,3 @@ pub fn get_device_prefix(
prefix
}
/// Parse a string containing an IPv4 address.
/// This is a convenience wrapper around the `no_std_net` parser.
///
/// # Args
/// * `input` - The IP address as a string.
///
/// # Returns
/// The IP address.
///
/// # Panic
/// This panics if parsing fails.
pub fn parse_ipv4(input: &str) -> IpAddr {
input.parse::<minimq::embedded_nal::IpAddr>().unwrap()
}