Added documentation to ip_and_cidr_from_string()
This commit is contained in:
		@@ -15,6 +15,18 @@ impl Network {
 | 
			
		||||
//     fn get_net_id(self) -> u8 {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Function that takes in a string reference and returns the result of splitting a string into 
 | 
			
		||||
/// both its Address and CIDR
 | 
			
		||||
/// 
 | 
			
		||||
/// ```
 | 
			
		||||
/// let ip_string = String::from("192.168.0.1/24");
 | 
			
		||||
/// let result = match ip_and_cidr_from_string(&ip_string) {
 | 
			
		||||
///     Err(_) => panic!(),
 | 
			
		||||
///     Ok(ip_and_cidr) => ip_and_cidr
 | 
			
		||||
/// };
 | 
			
		||||
/// 
 | 
			
		||||
/// >> (IpAddr::V4(192, 168, 0, 1), 24)
 | 
			
		||||
/// ```
 | 
			
		||||
pub fn ip_and_cidr_from_string(ip_and_cidr: &String) -> Result<(IpAddr, u8), ip::InvalidIPErr>{
 | 
			
		||||
    let mut cidr: u8 = Default::default();
 | 
			
		||||
    let mut ip: String = Default::default();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user