Skip to content

fx-kirin/pyo3_decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Decimal implementation as User Custom C API using PyO3

pyo3_decimal for c extention python class as pyo3 library.

pyo3_decimal_api for rust side pyo3 API library to use pyo3_decimal.Decimal.

pyo3_decimal_user is an usage example.

use pyo3;
use pyo3::prelude::*;
use pyo3_decimal_api::PyDecimal;

#[pyfunction]
/// Formats the sum of two numbers as string
fn decimal_test(a: PyDecimal) -> PyResult<PyDecimal> {
    Ok(a)
}

/// This module is a python module implemented in Rust.
#[pymodule]
fn rust_binding(py: Python, m: &PyModule) -> PyResult<()> {
    m.add_wrapped(wrap_pyfunction!(decimal_test))?;

    Ok(())
}

Blog

PyO3 で rust-decimal を C API 化する

About

C API Decimal class using PyO3, which can be imported from other pyo3 libraries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published