Skip to content

Commit ff859ee

Browse files
committed
feat: add in initial rust folder contents with best guess
1 parent 38dcdc3 commit ff859ee

File tree

3 files changed

+197
-0
lines changed

3 files changed

+197
-0
lines changed

{{cookiecutter.project_name}}/rust/Cargo.lock

Lines changed: 171 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "{{cookiecutter.project-name}}"
3+
version = "{{cookiecutter.version}}"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
[lib]
8+
name = "{{cookiecutter.package_name}}"
9+
crate-type = ["cdylib"]
10+
11+
[dependencies]
12+
pyo3 = "0.22.0"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use pyo3::prelude::*;
2+
3+
/// Formats the sum of two numbers as string.
4+
#[pyfunction]
5+
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
6+
Ok((a + b).to_string())
7+
}
8+
9+
/// A Python module implemented in Rust.
10+
#[pymodule]
11+
fn {{cookiecutter.package_name}}(m: &Bound<'_, PyModule>) -> PyResult<()> {
12+
m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
13+
Ok(())
14+
}

0 commit comments

Comments
 (0)