diff --git a/libs/rfc6052/src/embed.rs b/libs/rfc6052/src/embed.rs index 828bac3..b1ccfb1 100644 --- a/libs/rfc6052/src/embed.rs +++ b/libs/rfc6052/src/embed.rs @@ -8,14 +8,14 @@ use crate::error::Error; use crate::ALLOWED_PREFIX_LENS; /// Embeds an IPv4 address into an IPv6 prefix following the method defined in [RFC6052 Section 2.2](https://datatracker.ietf.org/doc/html/rfc6052#section-2.2) -/// +/// /// # Examples -/// +/// /// ``` /// # use ipnet::{Ipv6Net}; /// # use std::net::{Ipv4Addr, Ipv6Addr}; /// use rfc6052::embed_ipv4_addr; -/// +/// /// // An IPv4 address can be embedded into an IPv6 prefix of acceptable length /// assert_eq!( /// embed_ipv4_addr( @@ -24,7 +24,7 @@ use crate::ALLOWED_PREFIX_LENS; /// ), /// Ok("64:ff9b:c000:0201::".parse::<Ipv6Addr>().unwrap()) /// ); -/// +/// /// // Using a prefix that is not an RFC-approved length (in this case 66) will fail /// assert_eq!( /// embed_ipv4_addr( @@ -47,14 +47,14 @@ pub fn embed_ipv4_addr(ipv4_addr: Ipv4Addr, ipv6_prefix: Ipv6Net) -> Result<Ipv6 /// Embeds an IPv4 address into an IPv6 prefix following the method defined in [RFC6052 Section 2.2](https://datatracker.ietf.org/doc/html/rfc6052#section-2.2) /// /// **Warning:** This function does not check that the prefix length is valid according to the RFC. Use `embed_ipv4_addr` instead. -/// +/// /// # Examples -/// +/// /// ``` /// # use ipnet::{Ipv6Net}; /// # use std::net::{Ipv4Addr, Ipv6Addr}; /// use rfc6052::embed_ipv4_addr_unchecked; -/// +/// /// // Using a prefix that is not an RFC-approved length (in this case 66) will *succeed* /// // This is *not* the behavior of `embed_ipv4_addr` /// assert_eq!( diff --git a/libs/rfc6052/src/extract.rs b/libs/rfc6052/src/extract.rs index bc378ed..f2e0dd2 100644 --- a/libs/rfc6052/src/extract.rs +++ b/libs/rfc6052/src/extract.rs @@ -5,19 +5,19 @@ use std::cmp::max; use std::net::{Ipv4Addr, Ipv6Addr}; /// Extracts an IPv4 address from an IPv6 prefix following the method defined in [RFC6052 Section 2.2](https://datatracker.ietf.org/doc/html/rfc6052#section-2.2) -/// +/// /// # Examples -/// +/// /// ``` /// # use std::net::{Ipv4Addr, Ipv6Addr}; /// use rfc6052::extract_ipv4_addr; -/// +/// /// // An IPv4 address can be extracted from an IPv6 prefix of acceptable length /// assert_eq!( /// extract_ipv4_addr_unchecked("64:ff9b:c000:0201::".parse().unwrap(), 32), /// Ok("192.0.2.1".parse::<Ipv4Addr>().unwrap()) /// ); -/// +/// /// // Using a prefix that is not an RFC-approved length (in this case 66) will fail /// assert_eq!( /// extract_ipv4_addr_unchecked("64:ff9b:c000:0201::".parse().unwrap(), 66), @@ -37,13 +37,13 @@ pub fn extract_ipv4_addr(ipv6_addr: Ipv6Addr, prefix_length: u8) -> Result<Ipv4A /// Extracts an IPv4 address from an IPv6 prefix following the method defined in [RFC6052 Section 2.2](https://datatracker.ietf.org/doc/html/rfc6052#section-2.2) /// /// **Warning:** This function does not check that the prefix length is valid according to the RFC. Use `extract_ipv4_addr` instead. -/// +/// /// # Examples -/// +/// /// ``` /// # use std::net::{Ipv4Addr, Ipv6Addr}; /// use rfc6052::extract_ipv4_addr_unchecked; -/// +/// /// // Using a prefix that is not an RFC-approved length (in this case 66) will *succeed* /// // This is *not* the behavior of `extract_ipv4_addr` /// assert_eq!( diff --git a/libs/rfc6052/src/lib.rs b/libs/rfc6052/src/lib.rs index ef0a9fb..a396490 100644 --- a/libs/rfc6052/src/lib.rs +++ b/libs/rfc6052/src/lib.rs @@ -5,16 +5,16 @@ #![allow(clippy::missing_panics_doc)] #![allow(clippy::missing_safety_doc)] -mod error; mod embed; +mod error; mod extract; pub use embed::{embed_ipv4_addr, embed_ipv4_addr_unchecked}; pub use error::Error; pub use extract::{extract_ipv4_addr, extract_ipv4_addr_unchecked}; /// All allowed IPv6 prefix lengths according to [RFC6052 Section 2.2](https://datatracker.ietf.org/doc/html/rfc6052#section-2.2) -/// -/// While any prefix length between 32 and 96 bits can in theory work with this library, +/// +/// While any prefix length between 32 and 96 bits can in theory work with this library, /// the RFC strictly defines a list of allowed IPv6 prefix to be used for embedding IPv4 addresses. They are: /// - 32 bits /// - 40 bits