* . *
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Sunday, July 5, 2026
Earth-News
  • Home
  • Business
  • Entertainment

    Transforming Saint Paul’s Entertainment Complex into a Thriving Hub for the Future

    Get Ready for an Unforgettable Live Entertainment Lineup at Struthers’ Big Boy Train Celebration!

    Comic-Con Shocker: Beloved Annual Party Canceled in Surprise Move

    Miley Cyrus Stuns with Jaw-Dropping Barbie Doll Transformation!

    What Will Be Celebrated as an American Classic 250 Years from Now?

    How Investors Might Respond to PENN Entertainment’s Aurora Casino Launch and the Russell 2000 Shake-Up

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology

    Experience the Future of Farming at Farm Technology Days This July 14-16!

    Aviation Technology Launches Exciting New Interiors Division

    China-linked actors target more than technology as AI competition with U.S. intensifies – CNBC

    Is tech ruining the World Cup? – BBC

    Arch Appoints Chief Technology Officer – Family Wealth Report

    CrowdStrike Named Frost & Sullivan’s 2026 Global Enabling Technology Leader in Zero Trust Browser Security – Yahoo Finance

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment

    Transforming Saint Paul’s Entertainment Complex into a Thriving Hub for the Future

    Get Ready for an Unforgettable Live Entertainment Lineup at Struthers’ Big Boy Train Celebration!

    Comic-Con Shocker: Beloved Annual Party Canceled in Surprise Move

    Miley Cyrus Stuns with Jaw-Dropping Barbie Doll Transformation!

    What Will Be Celebrated as an American Classic 250 Years from Now?

    How Investors Might Respond to PENN Entertainment’s Aurora Casino Launch and the Russell 2000 Shake-Up

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology

    Experience the Future of Farming at Farm Technology Days This July 14-16!

    Aviation Technology Launches Exciting New Interiors Division

    China-linked actors target more than technology as AI competition with U.S. intensifies – CNBC

    Is tech ruining the World Cup? – BBC

    Arch Appoints Chief Technology Officer – Family Wealth Report

    CrowdStrike Named Frost & Sullivan’s 2026 Global Enabling Technology Leader in Zero Trust Browser Security – Yahoo Finance

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
Earth-News
No Result
View All Result
Home General

Write Elixir NIFs in Rust

August 6, 2023
in General
Write Elixir NIFs in Rust
Share on FacebookShare on Twitter

Documentation | Getting Started | Example

Build Status
Hex.pm package version
Crates.io package version
Last Updated

Rustler is a library for writing Erlang NIFs in safe Rust code. That means
there should be no ways to crash the BEAM (Erlang VM). The library provides
facilities for generating the boilerplate for interacting with the BEAM,
handles encoding and decoding of Erlang terms, and catches rust panics before
they unwind into C.

The library provides functionality for both Erlang and Elixir, however Elixir
is favored as of now.

Features:

Safety – The code you write in a Rust NIF should never be able to crash the BEAM.
Interop – Decoding and encoding rust values into Erlang terms is as easy as a function call.
Type composition – Making a Rust struct encodable and decodable to Erlang or Elixir can be done with a single attribute.
Resource objects – Enables you to safely pass a reference to a Rust struct into Erlang code. The struct will be automatically dropped when it’s no longer referenced.

Getting started

The easiest way of getting started is the rustler elixir library.

Add the rustler elixir library as a dependency of your project.
Run mix rustler.new to generate a new NIF in your project. Follow the instructions.
If you’re already using serde, consider using serde_rustler to easily encode and decode your data types into and from Elixir terms.

NOTE: If you have previously used Rustler, you need to run mix archive.uninstall rustler_installer.ez to remove it before generating the NIF.

What it looks like

This is the code for a minimal NIF that adds two numbers and returns the result.

#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
a + b
}

rustler::init!(“Elixir.Math”, [add]);

Minimal Supported Rust Version (MSRV)

Rustler currently has a minimal supported Rust version (MSRV) of 1.56.1. This
is the configured version in .clippy.toml.

Supported OTP and Elixir Versions

Rustler aims to support the newest three major OTP versions as well as newest three minor Elixir versions.

Supported NIF version

The minimal supported NIF version for a library should be defined via Cargo
features. The default is currently 2.14 (Erlang/OTP 21). To use features from
NIF version 2.16 (Erlang/OTP 24), the respective feature flag has to be
enabled on the dependency:

[dependencies]
rustler={ version=”…”, features=[“nif_version_2_16”] }

For compatibility reasons, this can be defined (and overridden) by setting the
RUSTLER_NIF_VERSION environment variable during build.

Community

You can find us in the #rustler:matrix.org channel on Matrix
or in the #rustler channel in the Elixir lang Slack.

License

Licensed under either of

Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

>>> Read full article>>>
Copyright for syndicated content belongs to the linked Source : Hacker News – https://docs.rs/crate/rustler/latest

Previous Post

People who’ve received a black bar on Hacker News

Next Post

Euros Bills Drawn Not to Represent Real Bridges. He Built Them All on This River

Ravens Outsmart Wolves by Anticipating Their Every Move

July 5, 2026

From July 4, 1776 to Today: The Incredible Journey of Space Science

July 5, 2026

Con Woman Caught Secretly Subletting Homes to Fuel Lavish Lifestyle

July 5, 2026

How Ancelotti Could Unlock Brazil’s Path to Their Sixth World Cup Triumph

July 5, 2026

Why Rising Fees and Insurance Costs Are Hitting Everyone’s Wallets Hard

July 5, 2026

Whatcom County Schools Fight to Keep Mental Health Services Alive Amid Funding Crisis

July 5, 2026

Transforming Saint Paul’s Entertainment Complex into a Thriving Hub for the Future

July 5, 2026

How the 2026 FIFA World Cup Reveals the Unbreakable Bond Between Sports and Politics

July 5, 2026

From Gay Penguins to Queering and Decolonizing Ecology: Rethinking Nature and Identity

July 4, 2026

Experience the Future of Farming at Farm Technology Days This July 14-16!

July 4, 2026

Categories

Archives

July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Jun    
Earth-News.info

The Earth News is an independent English-language daily published Website from all around the World News

Browse by Category

  • Business (20,132)
  • Ecology (1,300)
  • Economy (1,320)
  • Entertainment (22,199)
  • General (22,474)
  • Health (10,357)
  • Lifestyle (1,334)
  • News (22,149)
  • People (1,325)
  • Politics (1,342)
  • Science (16,535)
  • Sports (21,819)
  • Technology (16,306)
  • World (1,314)

Recent News

Ravens Outsmart Wolves by Anticipating Their Every Move

July 5, 2026

From July 4, 1776 to Today: The Incredible Journey of Space Science

July 5, 2026
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

Go to mobile version