niffler_precompiled/platform

Platform detection and NIF version compatibility.

The normalization rules mirror what rustler_precompiled does for Elixir: OTP reports a system architecture triple that is close to, but not always equal to, a Rust target triple. Windows is the main special case (“win32” for both 32- and 64-bit OTP), and macOS appends a kernel version to the OS component.

Types

pub type EnvOverrides {
  EnvOverrides(
    target: option.Option(String),
    arch: option.Option(String),
    vendor: option.Option(String),
    os: option.Option(String),
    abi: option.Option(String),
  )
}

Constructors

pub type Facts {
  Facts(
    system_architecture: String,
    os_type: #(String, String),
    wordsize: Int,
    nif_version: String,
    otp_release: String,
  )
}

Constructors

  • Facts(
      system_architecture: String,
      os_type: #(String, String),
      wordsize: Int,
      nif_version: String,
      otp_release: String,
    )

Values

pub fn current_target(
  facts: Facts,
  overrides: EnvOverrides,
) -> Result(String, String)

Detect the Rust target triple for the current platform.

pub fn extension(target: String) -> String

File extension OTP appends to a NIF path on this target.

pub fn no_overrides() -> EnvOverrides
pub fn otp_requirement(nif_version: String) -> String
pub fn select_nif_version(
  runtime: String,
  available: List(String),
) -> Result(String, Nil)

The highest manifest NIF version that this runtime can load.

pub fn supported_nif_versions() -> List(String)

Human-readable table used by the doctor command and error messages.

pub const supported_targets: List(String)
pub fn wordsize_to_arch(wordsize: Int) -> String
✨ Search Document