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
/// Whether a number is a usable TCP or UDP port: a whole number from 1 to
/// 65535. Port 0 is reserved (RFC 6335) and asks the operating system to pick
/// one, so it is never a port to connect to.
pub fn is_port(value: i64) -> bool {
(1..=65535).contains(&value)
}
pub fn fune_vector(args: &[Value]) -> Value {
// A fraction or a non-number is not a port, as TypeScript and Python answer.
match &args[0] {
Value::Int(i) => Value::Bool(is_port(*i)),
Value::Float(f) if f.fract() == 0.0 && f.abs() < 1e15 => Value::Bool(is_port(*f as i64)),
_ => Value::Bool(false),
}
}