Tried but can't seem to get Console input (Includes newline character)
This commit is contained in:
parent
43cd0f5bc5
commit
f2ad0de89b
20
src/main.rs
20
src/main.rs
@ -1,5 +1,23 @@
|
|||||||
|
use std::{io, str::FromStr};
|
||||||
|
|
||||||
mod networking;
|
mod networking;
|
||||||
|
use networking::ip::{IpAddr};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, World!")
|
println!("Enter the IP and CIDR for your given network");
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let mut ip = String::new();
|
||||||
|
io::stdin().read_line(&mut ip).unwrap();
|
||||||
|
let ip_address = match IpAddr::from_str(x) {
|
||||||
|
Err(_) => {
|
||||||
|
println!("fucked it");
|
||||||
|
IpAddr::V4(0, 0, 0, 0)
|
||||||
|
},
|
||||||
|
Ok(ip) => ip,
|
||||||
|
};
|
||||||
|
|
||||||
|
println!("you entered, {:?}", ip_address);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
mod ip;
|
pub mod ip;
|
||||||
use ip::IpAddr;
|
use ip::IpAddr;
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
Loading…
Reference in New Issue
Block a user