* . *
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Wednesday, May 14, 2025
Earth-News
  • Home
  • Business
  • Entertainment
    Downtown Frederick Partnership announces Alive@Five season lineup – The Frederick News-Post

    Get Ready for Fun: Downtown Frederick’s Exciting Alive@Five Season Lineup Revealed!

    ‘American Idol’ Top 3 revealed as 2 contestants eliminated: Who advanced to the Season 23 finale? – Yahoo

    ‘American Idol’ Top 3 revealed as 2 contestants eliminated: Who advanced to the Season 23 finale? – Yahoo

    60,000 Fans Caused a Small Earthquake Because of One Famous Rock Song – Yahoo

    How 60,000 Fans Rocked the Ground with One Iconic Song!

    Dan Spilo Out at Industry Entertainment After Incident on Set of Alan Ritchson Movie (Exclusive) – The Hollywood Reporter

    Dan Spilo Exits Industry Entertainment Following Controversial Incident on Set of Alan Ritchson Film

    John Legend Says He’s Shocked by Ye’s ‘Descent’ Into ‘Antisemitism’ and ‘Anti-Blackness’ – Yahoo

    John Legend Expresses Shock Over Ye’s Troubling Descent into Antisemitism and Anti-Blackness

    Free Flowin’ Fest brings entertainment to Pascagoula’s Beach Park – WLOX

    Experience the Excitement: Free Flowin’ Fest Lights Up Pascagoula’s Beach Park!

  • 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
    Bridger Photonics Appoints Ryan Sullivan as Chief Technology Officer to Accelerate New Era of Data Insights – Business Wire

    Bridger Photonics Welcomes Ryan Sullivan as CTO to Propel Data Insights into a New Era!

    Michigan Public Policy Survey suggests uncertainty among local officials on AI police surveillance technology – The Michigan Daily

    Local Officials Grapple with Uncertainty Over AI Surveillance Technology in Policing

    Trump Media & Technology Group: When Politics Gets A Ticker Symbol (NASDAQ:DJT) – Seeking Alpha

    Trump Media & Technology Group: When Politics Gets A Ticker Symbol (NASDAQ:DJT) – Seeking Alpha

    GenTech offers coding, AI lessons for elementary students – KTAR.com

    GenTech offers coding, AI lessons for elementary students – KTAR.com

    Arkansas Tech Univeristy-Ozark collision repair technology program re-accredited – Northwest Arkansas Democrat-Gazette

    Arkansas Tech University-Ozark’s Collision Repair Technology Program Earns Re-Accreditation!

    Top Chief Technology Officers to Watch in 2025: SMX’s Anthony Vultaggio – WashingtonExec

    Top Chief Technology Officers to Watch in 2025: SMX’s Anthony Vultaggio – WashingtonExec

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment
    Downtown Frederick Partnership announces Alive@Five season lineup – The Frederick News-Post

    Get Ready for Fun: Downtown Frederick’s Exciting Alive@Five Season Lineup Revealed!

    ‘American Idol’ Top 3 revealed as 2 contestants eliminated: Who advanced to the Season 23 finale? – Yahoo

    ‘American Idol’ Top 3 revealed as 2 contestants eliminated: Who advanced to the Season 23 finale? – Yahoo

    60,000 Fans Caused a Small Earthquake Because of One Famous Rock Song – Yahoo

    How 60,000 Fans Rocked the Ground with One Iconic Song!

    Dan Spilo Out at Industry Entertainment After Incident on Set of Alan Ritchson Movie (Exclusive) – The Hollywood Reporter

    Dan Spilo Exits Industry Entertainment Following Controversial Incident on Set of Alan Ritchson Film

    John Legend Says He’s Shocked by Ye’s ‘Descent’ Into ‘Antisemitism’ and ‘Anti-Blackness’ – Yahoo

    John Legend Expresses Shock Over Ye’s Troubling Descent into Antisemitism and Anti-Blackness

    Free Flowin’ Fest brings entertainment to Pascagoula’s Beach Park – WLOX

    Experience the Excitement: Free Flowin’ Fest Lights Up Pascagoula’s Beach Park!

  • 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
    Bridger Photonics Appoints Ryan Sullivan as Chief Technology Officer to Accelerate New Era of Data Insights – Business Wire

    Bridger Photonics Welcomes Ryan Sullivan as CTO to Propel Data Insights into a New Era!

    Michigan Public Policy Survey suggests uncertainty among local officials on AI police surveillance technology – The Michigan Daily

    Local Officials Grapple with Uncertainty Over AI Surveillance Technology in Policing

    Trump Media & Technology Group: When Politics Gets A Ticker Symbol (NASDAQ:DJT) – Seeking Alpha

    Trump Media & Technology Group: When Politics Gets A Ticker Symbol (NASDAQ:DJT) – Seeking Alpha

    GenTech offers coding, AI lessons for elementary students – KTAR.com

    GenTech offers coding, AI lessons for elementary students – KTAR.com

    Arkansas Tech Univeristy-Ozark collision repair technology program re-accredited – Northwest Arkansas Democrat-Gazette

    Arkansas Tech University-Ozark’s Collision Repair Technology Program Earns Re-Accreditation!

    Top Chief Technology Officers to Watch in 2025: SMX’s Anthony Vultaggio – WashingtonExec

    Top Chief Technology Officers to Watch in 2025: SMX’s Anthony Vultaggio – WashingtonExec

    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

Summit County health department braces for federal cuts, amount uncertain – KPCW

Summit County health department braces for federal cuts, amount uncertain – KPCW

May 14, 2025
Trump’s Middle East trip: President plans to lift Syria sanctions as he touts Saudi Arabia deals – CNN

Trump’s Middle East trip: President plans to lift Syria sanctions as he touts Saudi Arabia deals – CNN

May 13, 2025
Bridger Photonics Appoints Ryan Sullivan as Chief Technology Officer to Accelerate New Era of Data Insights – Business Wire

Bridger Photonics Welcomes Ryan Sullivan as CTO to Propel Data Insights into a New Era!

May 13, 2025
Attention to men’s professional sports still outpaces women’s, but there is closer parity for college sports – AP-NORC

Men’s Professional Sports Still Lead the Spotlight, But College Athletics Show Signs of Growing Parity

May 13, 2025
State lays out plan to tackle impacts of climate change in Washington – Department of Ecology – State of Washington (.gov)

Washington’s Bold Strategy to Combat Climate Change and Protect Our Future

May 13, 2025
The American brain drain has arrived. Just ask these scientists. – Business Insider

America’s Brain Drain: Insights from Leading Scientists

May 13, 2025
Class of 2025: Sophie Laman aimed straight for VCU’s forensic science program – VCU News

Class of 2025: Sophie Laman aimed straight for VCU’s forensic science program – VCU News

May 13, 2025
Lifestyle Diseases: Speed up implementation of front-of-pack labelling – Government urged – Africa Science News

Lifestyle Diseases: Speed up implementation of front-of-pack labelling – Government urged – Africa Science News

May 13, 2025
Climate crisis threatens the banana, the world’s most popular fruit, research shows – The Guardian

Climate crisis threatens the banana, the world’s most popular fruit, research shows – The Guardian

May 13, 2025
European economist says Russia’s economy is strained due to the Ukraine war and sanctions – Alton Telegraph

How the Ukraine War and Sanctions Are Straining Russia’s Economy

May 13, 2025

Categories

Archives

May 2025
MTWTFSS
 1234
567891011
12131415161718
19202122232425
262728293031 
« Apr    
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 (606)
  • Economy (617)
  • Entertainment (21,530)
  • General (15,214)
  • Health (9,661)
  • Lifestyle (623)
  • News (22,149)
  • People (620)
  • Politics (625)
  • Science (15,840)
  • Sports (21,128)
  • Technology (15,609)
  • World (608)

Recent News

Summit County health department braces for federal cuts, amount uncertain – KPCW

Summit County health department braces for federal cuts, amount uncertain – KPCW

May 14, 2025
Trump’s Middle East trip: President plans to lift Syria sanctions as he touts Saudi Arabia deals – CNN

Trump’s Middle East trip: President plans to lift Syria sanctions as he touts Saudi Arabia deals – CNN

May 13, 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