• About
  • Advertise
  • Privacy & Policy
  • Contact
Monday, September 25, 2023
Earth-News
  • Home
  • Business
  • Entertainment
    Carly Walton on the Benefits of Online Teaching

    Carly Walton on the Benefits of Online Teaching

    How the Toronto Star & CBC Exposed Ticketmaster’s Secret Scalper Program

    How the Toronto Star & CBC Exposed Ticketmaster’s Secret Scalper Program

    Michael Kaeshammer & Royal Wood

    Michael Kaeshammer & Royal Wood

    The Four Pillars of Success in Country Music

    The Four Pillars of Success in Country Music

    Why Sam Feldman Is Still Optimistic About the Music Biz

    Why Sam Feldman Is Still Optimistic About the Music Biz

    Gisele Bündchen Would Still Divorce Tom Brady if She Was Offered a Do-Over

    Gisele Bündchen Would Still Divorce Tom Brady if She Was Offered a Do-Over

  • General
  • Health
  • News
    Congress to hold press conferences in 21 cities to ‘expose’ government on women’s reservation

    Congress to hold press conferences in 21 cities to ‘expose’ government on women’s reservation

    Rupee falls 16 paise to 83.10 against US dollar in early trade

    Rupee falls 16 paise to 83.10 against US dollar in early trade

    ಜನರ ವಿನಿಮಯವನ್ನು ರಾಜಕೀಯಗೊಳಿಸುವುದು

    ಜನರ ವಿನಿಮಯವನ್ನು ರಾಜಕೀಯಗೊಳಿಸುವುದು

    India Canada row live updates | Canada’s Defence Minister describes relationship with India ‘important’

    India Canada row live updates | Canada’s Defence Minister describes relationship with India ‘important’

    ಅನುಚಿತ ವರ್ತನೆ

    ಅನುಚಿತ ವರ್ತನೆ

    After Leaders Disappear, China’s Army Warns Military Personnel Against Socializing With ‘Wrong People’

    After Leaders Disappear, China’s Army Warns Military Personnel Against Socializing With ‘Wrong People’

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Tech
    Amazon to invest up to $4 billion in AI startup Anthropic

    Amazon to invest up to $4 billion in AI startup Anthropic

    Correcto grabs $7M to build out its ‘Grammarly for Spanish’

    Correcto grabs $7M to build out its ‘Grammarly for Spanish’

    California governor vetoes bill to ban driverless AV trucks

    California governor vetoes bill to ban driverless AV trucks

    A conversation with Cruise’s Kyle Vogt, Bird scoops up Spin, and self-driving trucks live to see another day in Cali

    A conversation with Cruise’s Kyle Vogt, Bird scoops up Spin, and self-driving trucks live to see another day in Cali

    MultiChoice share price has plunged by almost 50% in the last six months

    MultiChoice share price has plunged by almost 50% in the last six months

    Get two 4K camera drones on sale for $110 for a limited time

    Get two 4K camera drones on sale for $110 for a limited time

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment
    Carly Walton on the Benefits of Online Teaching

    Carly Walton on the Benefits of Online Teaching

    How the Toronto Star & CBC Exposed Ticketmaster’s Secret Scalper Program

    How the Toronto Star & CBC Exposed Ticketmaster’s Secret Scalper Program

    Michael Kaeshammer & Royal Wood

    Michael Kaeshammer & Royal Wood

    The Four Pillars of Success in Country Music

    The Four Pillars of Success in Country Music

    Why Sam Feldman Is Still Optimistic About the Music Biz

    Why Sam Feldman Is Still Optimistic About the Music Biz

    Gisele Bündchen Would Still Divorce Tom Brady if She Was Offered a Do-Over

    Gisele Bündchen Would Still Divorce Tom Brady if She Was Offered a Do-Over

  • General
  • Health
  • News
    Congress to hold press conferences in 21 cities to ‘expose’ government on women’s reservation

    Congress to hold press conferences in 21 cities to ‘expose’ government on women’s reservation

    Rupee falls 16 paise to 83.10 against US dollar in early trade

    Rupee falls 16 paise to 83.10 against US dollar in early trade

    ಜನರ ವಿನಿಮಯವನ್ನು ರಾಜಕೀಯಗೊಳಿಸುವುದು

    ಜನರ ವಿನಿಮಯವನ್ನು ರಾಜಕೀಯಗೊಳಿಸುವುದು

    India Canada row live updates | Canada’s Defence Minister describes relationship with India ‘important’

    India Canada row live updates | Canada’s Defence Minister describes relationship with India ‘important’

    ಅನುಚಿತ ವರ್ತನೆ

    ಅನುಚಿತ ವರ್ತನೆ

    After Leaders Disappear, China’s Army Warns Military Personnel Against Socializing With ‘Wrong People’

    After Leaders Disappear, China’s Army Warns Military Personnel Against Socializing With ‘Wrong People’

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Tech
    Amazon to invest up to $4 billion in AI startup Anthropic

    Amazon to invest up to $4 billion in AI startup Anthropic

    Correcto grabs $7M to build out its ‘Grammarly for Spanish’

    Correcto grabs $7M to build out its ‘Grammarly for Spanish’

    California governor vetoes bill to ban driverless AV trucks

    California governor vetoes bill to ban driverless AV trucks

    A conversation with Cruise’s Kyle Vogt, Bird scoops up Spin, and self-driving trucks live to see another day in Cali

    A conversation with Cruise’s Kyle Vogt, Bird scoops up Spin, and self-driving trucks live to see another day in Cali

    MultiChoice share price has plunged by almost 50% in the last six months

    MultiChoice share price has plunged by almost 50% in the last six months

    Get two 4K camera drones on sale for $110 for a limited time

    Get two 4K camera drones on sale for $110 for a limited time

    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

Coinbase Bolsters EU Presence: Gains Registration in Spain

Coinbase Bolsters EU Presence: Gains Registration in Spain

September 25, 2023
Spread Betting on Spreadex: FY23 Profit Surges 28%

Spread Betting on Spreadex: FY23 Profit Surges 28%

September 25, 2023
CoinShares Expands into U.S: Launching Hedge Fund Division

CoinShares Expands into U.S: Launching Hedge Fund Division

September 25, 2023
Exclusive: XTB Introduces ETF-Based ‘Investment Plans’ to Lure Passive Investors

Exclusive: XTB Introduces ETF-Based ‘Investment Plans’ to Lure Passive Investors

September 25, 2023
What Will a US Government Shutdown Mean for Global Markets?

What Will a US Government Shutdown Mean for Global Markets?

September 25, 2023
My Video About Boring Company, SpaceX and Elon Musk Reading Nextbigfuture

My Video About Boring Company, SpaceX and Elon Musk Reading Nextbigfuture

September 25, 2023
Human Limits 122 Years and 4 Minute Miles

Human Limits 122 Years and 4 Minute Miles

September 25, 2023
Agility Robotics Will Mass Produce 10,000 Humanoid Robots Per Year

Agility Robotics Will Mass Produce 10,000 Humanoid Robots Per Year

September 25, 2023
Amazon to invest up to $4 billion in AI startup Anthropic

Amazon to invest up to $4 billion in AI startup Anthropic

September 25, 2023
Correcto grabs $7M to build out its ‘Grammarly for Spanish’

Correcto grabs $7M to build out its ‘Grammarly for Spanish’

September 25, 2023
Partenaires
afric.info
europ.info
usa-news
lesmeilleureschaussures.fr
goodsforyoutoday.com
looktopbeauty.com
keto-diet.biz
soccernews.info
nba-news.net
sportsprblog.com compar.biz
the-best.top
bestchoices.biz
expert-plus.fr
travel-mag.info
pksportsnews.com
news-sports.org

Categories

Archives

September 2023
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  
« 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 (3,436)
  • Entertainment (3,502)
  • General (2,521)
  • Health (1,675)
  • News (3,954)
  • Science (2,709)
  • Sports (3,657)
  • Tech (2,667)

Recent News

Coinbase Bolsters EU Presence: Gains Registration in Spain

Coinbase Bolsters EU Presence: Gains Registration in Spain

September 25, 2023
Spread Betting on Spreadex: FY23 Profit Surges 28%

Spread Betting on Spreadex: FY23 Profit Surges 28%

September 25, 2023
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

Go to mobile version

Write Elixir NIFs in Rust- https://www.les-livres.fr   https://soccernews.info   https://vinsdivins.fr   https://www.animaleries.info   https://nyumba-ya-mumbi.org   https://minipc.biz   https://www.fournitures-de-bureau.biz/   https://www.lesmaillotsdebain.fr   -/- Vahiné – Arome Citron 20Ml – Lot De 5 – Livraison Rapide En France – Prix Par Lot   WOLVERINE ET LES X-MEN T02   London 2012 all-around gymnastics champion Douglas eyeing Paris 2024 comeback   France – Namibie (96-0) : les notes des Bleus   Lung cancer cases in women in the UK projected to surpass men   -*-$$Dominique Blanc repasse le bac   20 Best MagSafe Accessories for Your iPhone (2023): Webcam Mount, Car Docks, Wireless Chargers   College Basketball’s Insider Jon Rothstein ranks Rutgers basketball No. 43   Julian Iantzi, presentador de ‘El Conquistador’, obligado a desmentir la noticia de su muerte   The immune well being future, at present | Penn At this time – Penn At this time   $$* Hamac Gonflable,Sofa d’air Imperméable à L’eau Avec le Paquet portatif, Lit d’air de Sofa Gonflable de Fainéant Paresseux pour Cour, Lac, Plage, Camping, Pique-niques et Les festivals de Musique   Soldes d’été : -33 % sur la Logitech G502 X Lightspeed, la reine des souris gamer sans fil   Write Elixir NIFs in Rust *Write Elixir NIFs in Rust