platform

Types

pub type Arch {
  Arm
  Arm64
  X86
  X64
  Loong64
  Mips
  MipsLittleEndian
  PPC
  PPC64
  RiscV64
  S390
  S390X
  OtherArch(String)
}

Constructors

  • Arm
  • Arm64
  • X86
  • X64
  • Loong64
  • Mips
  • MipsLittleEndian
  • PPC
  • PPC64
  • RiscV64
  • S390
  • S390X
  • OtherArch(String)
pub type Os {
  Aix
  Darwin
  FreeBsd
  Linux
  OpenBsd
  SunOs
  Win32
  OtherOs(String)
}

Constructors

  • Aix
  • Darwin
  • FreeBsd
  • Linux
  • OpenBsd
  • SunOs
  • Win32
  • OtherOs(String)
pub type Runtime {
  Erlang
  Node
  Bun
  Deno
  Browser
  OtherRuntime(String)
}

Constructors

  • Erlang
  • Node
  • Bun
  • Deno
  • Browser
  • OtherRuntime(String)

Functions

pub fn arch() -> Arch

Returns the CPU architecture of the host system

In web browsers, this will always return OtherArch(“unknown”)

On erlang for windows, it’ll always return either X86 or X64, even under a beam vm compiled for arm. This is because there is no simple way to get the cpu archictecture on windows, and it currently uses the bitness of the cpu to guess it instead.

As of 22nd August 2024, there are no prebuilt binaries for windows for arm, so this shouldn’t matter

pub fn os() -> Os

Returns the host operating system this appication is running on

In web browsers, this will always return OtherOs(“unknown”)

pub fn runtime() -> Runtime

Returns the runtime this application is running on

On the erlang target, it’ll always return Erlang

On the js target, it’ll try to detect the js runtime

Search Document