Skip to content

Latest commit

 

History

History
28 lines (15 loc) · 592 Bytes

readme.md

File metadata and controls

28 lines (15 loc) · 592 Bytes

Introduction

This is an example about how to use pyo3 library. We can call rust functions in python scripts.

In src/function.rs, we define two function add and sum_as_string.

In src/bin/function_test.rs, we test two functions.

In src/lib.rs, we define the interface for python and rust.

In src/python/call_test.py, we show how to use python to call rust functions.

How to run

  1. build the rust project and generate library
cargo build --release
  1. go to src/python directory
python call_test.py