IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

IpAddr

struct IpAddr

Represents either an IPv4 or an IPv6 address.

Implemented traits​

AnyType, Copyable, Deinitable, EnumLike, Equatable, ImplicitlyCopyable, Movable, Writable, __Enum

Methods​

__eq__​

def __eq__(self, other: Self) -> Bool

Returns whether two addresses are equal.

Args:

  • ​other (Self): The address to compare against.

Returns:

Bool: True if both addresses have the same family and value.

write_to​

def write_to(self, mut writer: T)

Writes the address in the notation of its family.

Args:

  • ​writer (T): The writer to write to.

v4​

static def v4(var payload: Ipv4Addr, /) -> Self

An IPv4 address.

v6​

static def v6(var payload: Ipv6Addr, /) -> Self

An IPv6 address.