Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vickenty/perl-xs
High-level Rust bindings to Perl XS API
https://github.com/vickenty/perl-xs
Last synced: 3 months ago
JSON representation
High-level Rust bindings to Perl XS API
- Host: GitHub
- URL: https://github.com/vickenty/perl-xs
- Owner: vickenty
- License: bsd-2-clause
- Archived: true
- Created: 2016-01-07T00:50:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-27T18:26:48.000Z (about 4 years ago)
- Last Synced: 2024-08-01T03:25:20.337Z (6 months ago)
- Language: Rust
- Homepage:
- Size: 154 KB
- Stars: 59
- Watchers: 9
- Forks: 14
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cn - vickenty/perl-xs - ci.org/vickenty/perl-xs.svg?branch=master">](https://travis-ci.org/vickenty/perl-xs) (Development tools / FFI)
- awesome-rust - vickenty/perl-xs - ci.org/vickenty/perl-xs.svg?branch=master">](https://travis-ci.org/vickenty/perl-xs) (Development tools / FFI)
- awesome-rust-zh - vickenty/perl-xs - 使用 Rust 创建 Perl XS 模块[<img src="https://api.travis-ci.org/vickenty/perl-xs.svg?branch=master">](https://travis-ci.org/vickenty/perl-xs) (开发工具 / FFI)
- awesome-rust - vickenty/perl-xs - ci.org/vickenty/perl-xs.svg?branch=master">](https://travis-ci.org/vickenty/perl-xs) (开发工具 Development tools / 示例 FFI)
README
[![Build Status](https://travis-ci.org/vickenty/perl-xs.svg?branch=master)](https://travis-ci.org/vickenty/perl-xs)
# Perl XS for Rust
High-level Rust bindings to Perl XS API.
## Example
```rust
xs! {
package Array::Sum;
sub sum_array(ctx, array: AV) {
array.iter().map(|it| it.unwrap_or(0.0)).sum::()
}
}
```For a more complete example see the XSTest package in the `t/` directory.
## Goals
- safety
- correctness
- speedPerl 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:
```shell
cpanm --installdeps .
```To run tests:
```shell
(cd t && perl Makefile.PL && make test)
```