Prefix

typePrefix

An IP address prefix: the combination of an IP address and a prefix length.

A prefix can be constructed with the / operator or with the Prefix.new function. This operator takes an IpAddr and a u8 as operands.

Roto
let a = 1.1.1.0 / 8;
let b = 192.0.0.0 / 24;
methodaddr(self: Prefix) IpAddr

Returns the IP address part of a prefix.

methodeq(self: Prefix, other: Prefix) bool

Check whether those prefixes are the same.

methodlen(self: Prefix) u8

Returns the length part of a prefix.

methodmax_addr(self: Prefix) IpAddr

Returns the largest address of the prefix.

methodmin_addr(self: Prefix) IpAddr

Returns the smallest address of the prefix.

This is the same as Prefix.addr.

methodnew(ip: IpAddr, len: u8) Prefix

Construct a new prefix.

A prefix can also be constructed with the / operator.

Roto
let a = Prefix.new(192.169.0.0, 16);

// or equivalently
let b = 192.169.0.0 / 16;
methodto_string(self: Prefix) String

Convert this value into a String.