Skip to content
forked from vickenty/perl-xs

High-level Rust bindings to Perl XS API

License

Notifications You must be signed in to change notification settings

gudtech/perl-xs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

High-level Rust bindings to Perl XS API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 83.8%
  • Perl 15.5%
  • Other 0.7%