* . *
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Friday, September 19, 2025
Earth-News
  • Home
  • Business
  • Entertainment
    Congress Bill Spotlight: Make Entertainment Great Again (MEGA) Act, Renaming Kennedy Center to Trump Center – The Fulcrum

    Congress Proposes MEGA Act to Rename Kennedy Center as Trump Center and Revitalize Entertainment

    Massive Attack Say They’ll Remove Music From Spotify – yahoo.com

    Massive Attack Announces Plans to Pull Their Music from Spotify

    REO to return for UI homecoming – The News-Gazette

    REO Gears Up to Ignite the Stage at UI Homecoming Celebration!

    Gen V Season 2: What is The Odessa Project? – yahoo.com

    Gen V Season 2: Unlocking the Secrets of The Odessa Project

    PENN Entertainment stock rating reiterated at Market Outperform by JMP – Investing.com

    PENN Entertainment Stock Rated a Market Outperformer by Experts

    Here’s how NJ’s once-vibrant nightclub scene was born and why it died – Bergen Record

    The Rise and Fall of New Jersey’s Once-Vibrant Nightclub Scene: What Happened?

  • 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
    Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

    Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

    China says US TikTok deal a ‘win-win’, will review app’s technology and IP transfers – Reuters

    China Hails US TikTok Deal as a ‘Win-Win’ While Launching Review of App’s Technology and IP Transfers

    Bucking the Odds: Why Technology Companies Should Embrace Software Patents Today – Crowell & Moring LLP

    Bucking the Odds: Why Technology Companies Should Embrace Software Patents Today – Crowell & Moring LLP

    City IT presented Best of North Carolina Technology Award – RaleighNC.gov

    City IT Honored with Best of North Carolina Technology Award

    LELO Releases 2025 Futurist Report: Intergenerational Views on Relationships, Sex, and Technology – PR Newswire

    Exploring the Future: How Different Generations View Relationships, Sex, and Technology in 2025

    Will New Big Technology Engagements Reshape Innodata’s Growth Path? – Yahoo Finance

    Could New Major Tech Partnerships Propel Innodata to Unprecedented Growth?

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment
    Congress Bill Spotlight: Make Entertainment Great Again (MEGA) Act, Renaming Kennedy Center to Trump Center – The Fulcrum

    Congress Proposes MEGA Act to Rename Kennedy Center as Trump Center and Revitalize Entertainment

    Massive Attack Say They’ll Remove Music From Spotify – yahoo.com

    Massive Attack Announces Plans to Pull Their Music from Spotify

    REO to return for UI homecoming – The News-Gazette

    REO Gears Up to Ignite the Stage at UI Homecoming Celebration!

    Gen V Season 2: What is The Odessa Project? – yahoo.com

    Gen V Season 2: Unlocking the Secrets of The Odessa Project

    PENN Entertainment stock rating reiterated at Market Outperform by JMP – Investing.com

    PENN Entertainment Stock Rated a Market Outperformer by Experts

    Here’s how NJ’s once-vibrant nightclub scene was born and why it died – Bergen Record

    The Rise and Fall of New Jersey’s Once-Vibrant Nightclub Scene: What Happened?

  • 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
    Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

    Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

    China says US TikTok deal a ‘win-win’, will review app’s technology and IP transfers – Reuters

    China Hails US TikTok Deal as a ‘Win-Win’ While Launching Review of App’s Technology and IP Transfers

    Bucking the Odds: Why Technology Companies Should Embrace Software Patents Today – Crowell & Moring LLP

    Bucking the Odds: Why Technology Companies Should Embrace Software Patents Today – Crowell & Moring LLP

    City IT presented Best of North Carolina Technology Award – RaleighNC.gov

    City IT Honored with Best of North Carolina Technology Award

    LELO Releases 2025 Futurist Report: Intergenerational Views on Relationships, Sex, and Technology – PR Newswire

    Exploring the Future: How Different Generations View Relationships, Sex, and Technology in 2025

    Will New Big Technology Engagements Reshape Innodata’s Growth Path? – Yahoo Finance

    Could New Major Tech Partnerships Propel Innodata to Unprecedented Growth?

    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

Scientists say they’ve found the world’s oldest mummies, and they’re far from Egypt – NBC News

Scientists say they’ve found the world’s oldest mummies, and they’re far from Egypt – NBC News

September 19, 2025
The growing chasm between MAGA and non-MAGA Republicans on Trump’s economy – Axios

The growing chasm between MAGA and non-MAGA Republicans on Trump’s economy – Axios

September 19, 2025
Congress Bill Spotlight: Make Entertainment Great Again (MEGA) Act, Renaming Kennedy Center to Trump Center – The Fulcrum

Congress Proposes MEGA Act to Rename Kennedy Center as Trump Center and Revitalize Entertainment

September 19, 2025
CHOP researchers unveil framework for boosting children’s oral health – News-Medical

Revolutionary New Framework Set to Transform Children’s Oral Health

September 19, 2025
‘We will not allow politics or outside forces to rewrite the story of Wisconsin’s public schools’: Underly delivers her fifth State of Education Address – Spectrum News

Underly Pledges to Shield Wisconsin’s Public Schools from Political Interference in Impactful Education Speech

September 19, 2025
Simons Collaborations in Ecology and Evolution – Simons Foundation

Innovative Breakthroughs in Ecology and Evolution Through Collaborative Research

September 19, 2025
Michigan Science Center’s vertical wind tunnel demonstration – CBS News

Experience the Thrill of Michigan Science Center’s Vertical Wind Tunnel Demonstration!

September 19, 2025
Roane State and TCAT Knoxville celebrate ‘Countdown to Grand Opening’ for Knox Regional Health Science Education Center – WVLT

Roane State and TCAT Knoxville Kick Off Exciting Countdown to Grand Opening of Knox Regional Health Science Education Center

September 19, 2025
Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

Huawei Unveils New AI Chip Tech to Challenge Nvidia’s Lead – Bloomberg.com

September 19, 2025
Klutch Sports Group Signs Maria Taylor – Variety

Klutch Sports Group Scores Big with Star Broadcaster Maria Taylor Joining the Team

September 18, 2025

Categories

Archives

September 2025
MTWTFSS
1234567
891011121314
15161718192021
22232425262728
2930 
« Aug    
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 (826)
  • Economy (846)
  • Entertainment (21,725)
  • General (17,118)
  • Health (9,891)
  • Lifestyle (859)
  • News (22,149)
  • People (850)
  • Politics (856)
  • Science (16,056)
  • Sports (21,345)
  • Technology (15,828)
  • World (830)

Recent News

Scientists say they’ve found the world’s oldest mummies, and they’re far from Egypt – NBC News

Scientists say they’ve found the world’s oldest mummies, and they’re far from Egypt – NBC News

September 19, 2025
The growing chasm between MAGA and non-MAGA Republicans on Trump’s economy – Axios

The growing chasm between MAGA and non-MAGA Republicans on Trump’s economy – Axios

September 19, 2025
  • 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