Functional Weave
Code in Rust

net.ipv4@1.0.0

impl/rust/is_ipv4.rs

305 bytes · the Rust implementation · view raw

Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.

use super::funejson::Value;  ← the fune runtime: the JSON value the test vectors use; fune build keeps it only where a signature takes one
use super::net_ipv4_parse_ipv4::ipv4_value;  ← parseIpv4, another function of this group · built into the same file, even by a slim install

/// True exactly when parse_ipv4 would accept the text; never panics.
pub fn is_ipv4(text: &str) -> bool {
    ipv4_value(text).is_some()
}

pub fn fune_vector(args: &[Value]) -> Value {
    Value::Bool(is_ipv4(args[0].as_str()))
}