-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: rust branch init changes * feat: rename rustlib to crates
- Loading branch information
1 parent
caeece5
commit dd8db6e
Showing
7 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include Cargo.toml | ||
recursive-include crates *.rs | ||
recursive-include src * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "crates" | ||
version = "0.1.0" | ||
|
||
[lib] | ||
name = "_lib" | ||
crate-type = ["cdylib"] | ||
path = "src/lib.rs" | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.21.0", features = ["extension-module"] } | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
# See also PyO3 docs on writing Cargo.toml files at https://pyo3.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use pyo3::prelude::*; | ||
|
||
#[pyfunction] | ||
#[pyo3(text_signature = "(a, b, /)")] | ||
pub fn add_in_rust(a: i32, b: i32) -> PyResult<i32> { | ||
Ok(a + b) | ||
} | ||
|
||
#[pyfunction] | ||
#[pyo3(text_signature = "(a, b, /)")] | ||
pub fn subtract_in_rust(a: i32, b: i32) -> PyResult<i32> { | ||
Ok(a - b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//mod.rs | ||
pub mod basic_math; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//src/lib.rs | ||
|
||
pub mod basic_functions; | ||
use crate::basic_functions::*; | ||
|
||
use pyo3::prelude::*; | ||
|
||
#[pymodule] | ||
fn quippers(_py: Python, m: &PyModule) -> PyResult<()> { | ||
m.add_function(wrap_pyfunction!(basic_math::add_in_rust, m)?)?; | ||
m.add_function(wrap_pyfunction!(basic_math::subtract_in_rust, m)?)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters