Giter VIP home page Giter VIP logo

perl-xs's Introduction

Build Status

Perl XS for Rust

High-level Rust bindings to Perl XS API.

Example

xs! {
  package Array::Sum;
  sub sum_array(ctx, array: AV) {
    array.iter().map(|it| it.unwrap_or(0.0)).sum::<NV>()
  }
}

For a more complete example see the XSTest package in the t/ directory.

Goals

  • safety
  • correctness
  • speed

Perl XS API is deliberately low-level and requires user to maintain a good deal of internal invariants, thus allowing for very fast code. This package takes a different approach of encapsulating implementation details to provide a simpler and safer API at the cost of speed.

For now, this library focuses on Perl's public documented API, which is a small subset of what is available to authors of modules written in C.

Work in progress

This project is very much in progress. It is not yet clear if project goals are attainable at all or if the API will make any sense in practice.

How to use

Module::Install::Rust integrates traditional Perl build system with Cargo, allowing Rust code to be compiled and installed using familiar perl Makefile.PL && make process. For example, see test package under t directory.

Prerequisites

  • Perl 5.20+ (for 64-bit array methods)
  • Rust 1.31+

Testing

To install packages required for testing and benchmarking:

cpanm --installdeps .

To run tests:

(cd t && perl Makefile.PL && make test)

perl-xs's People

Contributors

vickenty avatar hiratara avatar dnorman avatar mbudde avatar jtk18 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.