Crate fancy_ip

source ·
Expand description

Adds a fancy way to generate IP addresses and socket addresses from its string representation

This library aims to replace the use of parse() or new() functions for initializing an IP address using a macro call. This approach allows the emission of compile-time errors when an address is malformed and the use of human-readable addresses in const contexts.

Using in #[no_std] contexts

This library can be used in #[no_std] contexts by using the core implementation of addresses instead of the std implementation.

⚠️ Address in core is currently an unstable feature.

In order to use this feature, you must use the nightly toolchain and enable the ip_in_core in main.rs or lib.rs as is:

#![feature(ip_in_core)]

No external IP address provider is planned to be supported. If you want to use fancy-ip in #[no_std] context with the stable or beta toolchain: be patient.

In order to use fancy-ip in no_std contexts, you must add this library in your Cargo.toml disabling the default features:

fancy-ip = { version = "0.1", default_features = false }

Macros

  • Generate an IP address from the standard textual representation (both support IPv4 and IPv6)
  • Generate an IPv4 address from the standard textual representation
  • Generate an IPv6 address from the standard textual representation
  • Generates a socket address from its string representation
  • Generates a socket address from its string representation
  • Generates a socket address from its string representation