{"id":14069301,"url":"https://github.com/extendr/extendr","last_synced_at":"2025-04-14T20:43:42.701Z","repository":{"id":37916787,"uuid":"254169150","full_name":"extendr/extendr","owner":"extendr","description":"R extension library for rust designed to be familiar to R users.","archived":false,"fork":false,"pushed_at":"2025-04-11T15:30:57.000Z","size":98337,"stargazers_count":452,"open_issues_count":132,"forks_count":50,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-12T23:18:52.739Z","etag":null,"topics":["api-wrapper","extension","ffi-bindings","r","rust"],"latest_commit_sha":null,"homepage":"https://extendr.github.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extendr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-08T18:30:10.000Z","updated_at":"2025-04-11T16:05:11.000Z","dependencies_parsed_at":"2023-09-21T20:33:51.107Z","dependency_job_id":"88d759bd-66ee-4cfe-b657-e8280d217cb2","html_url":"https://github.com/extendr/extendr","commit_stats":{"total_commits":422,"total_committers":23,"mean_commits":"18.347826086956523","dds":0.490521327014218,"last_synced_commit":"fc677380fa03c638e7913fdd96140da9ff1a5ad4"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fextendr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fextendr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fextendr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extendr%2Fextendr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extendr","download_url":"https://codeload.github.com/extendr/extendr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643554,"owners_count":21138459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-wrapper","extension","ffi-bindings","r","rust"],"created_at":"2024-08-13T07:06:49.756Z","updated_at":"2025-04-14T20:43:42.678Z","avatar_url":"https://github.com/extendr.png","language":"Rust","readme":"# `extendr` - A safe and user friendly R extension interface using Rust\n\n[![Github Actions Build Status](https://github.com/extendr/extendr/workflows/Tests/badge.svg)](https://github.com/extendr/extendr/actions)\n[![Crates.io](https://img.shields.io/crates/v/extendr-api.svg)](https://crates.io/crates/extendr-api)\n[![Documentation](https://docs.rs/extendr-api/badge.svg)](https://docs.rs/extendr-api)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.06394/status.svg)](https://doi.org/10.21105/joss.06394)\n\n[![Logo](https://github.com/extendr/extendr/raw/master/extendr-logo-256.png)](https://github.com/extendr/extendr/raw/master/extendr-logo-256.png)\n\n## Welcome\n\nextendR is a suite of software packages, see the website [extendR](https://extendr.github.io/) for an overview.\n\nThis repository is for the rust crates that are part of extendR,\nsee also [`{rextendr}`](https://extendr.github.io/rextendr/) for the R-package that facilitates using extendR.\n\nA complete user guide detailing how to use extendR is [available here](https://extendr.github.io/user-guide/).\n\nThe main crate `extendr-api` is published on [crates.io](https://crates.io/crates/extendr-api).\n\n## Getting started\n\nThere are many ways to use extendR from R. In an interactive R session one may\nuse [`rextendr::rust_function` and friends](https://extendr.github.io/rextendr/reference/rust_source.html)\nto quickly prototype Rust code.\n\nIn an R package context, one may use [`rextendr::use_extendr()`](https://extendr.github.io/rextendr/reference/use_extendr.html) to setup a Rust powered R-package. See also [vignette on R-packages](https://extendr.github.io/rextendr/articles/package.html).\n\nIt is also possible to inline Rust code in `RMarkdown`/`knitr`, see [vignette on extendr `knitr-engine`](https://extendr.github.io/rextendr/articles/rmarkdown.html).\n\nSee [rextendr](https://extendr.github.io/rextendr/) package for more information\non the available functionality from an R session.\n\n## Overview\n\nIt is intended to be easier to use than the C interface and\nRcpp as Rust gives type safety and freedom from segfaults.\n\nThe following code illustrates a simple structure trait\nwhich is written in Rust. The data is defined in the `struct`\ndeclaration and the methods in the `impl`.\n\n```rust\nuse extendr_api::prelude::*;\n\n#[extendr]\nstruct Person {\n    pub name: String,\n}\n\n#[extendr]\nimpl Person {\n    fn new() -\u003e Self {\n        Self { name: \"\".to_string() }\n    }\n\n    fn set_name(\u0026mut self, name: \u0026str) {\n        self.name = name.to_string();\n    }\n\n    fn name(\u0026self) -\u003e \u0026str {\n        self.name.as_str()\n    }\n}\n\n#[extendr]\nfn aux_func() {\n}\n\n\n// Macro to generate exports\nextendr_module! {\n    mod classes;\n    impl Person;\n    fn aux_func;\n}\n```\n\nThe `#[extendr]` attribute causes the compiler to generate\nwrapper and registration functions for R which are called\nwhen the package is loaded.\n\nThe `extendr_module!` macro lists the module name and exported functions\nand interfaces.\n\nThis library aims to provide an interface that will be familiar to\nfirst-time users of Rust or indeed any compiled language.\n\n## Goals of the project\n\nInstead of wrapping R objects, we convert to Rust native objects\non entry to a function. This makes the wrapped code clean and dependency\nfree. The ultimate goal is to allow the wrapping of existing\nRust libraries without markup, but in the meantime, the markup\nis as light as possible.\n\n```rust\n#[extendr]\npub fn my_sum(v: \u0026[f64]) -\u003e f64 {\n    v.iter().sum()\n}\n```\n\nYou can interact in more detail with R objects using the `Robj`\ntype which wraps the native R object type. This supports a large\nsubset of the R internals functions, but wrapped to prevent\naccidental segfaults and failures.\n\n## Contributing\n\nWe are happy about any contributions!\n\nTo get started you can take a look at our [Github issues](https://github.com/extendr/extendr/issues).\n\nYou can also get in contact via our [Discord server](https://discord.gg/7hmApuc)!\n\n### Development\n\nThe documentation for the latest development version of `extendr-api` is available here:\n\u003chttps://extendr.github.io/extendr/extendr_api/\u003e\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextendr%2Fextendr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextendr%2Fextendr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextendr%2Fextendr/lists"}