Skip to content

This is an example. We can call rust functions in python scripts by using pyo3 library.

Notifications You must be signed in to change notification settings

amyzx/pyo3_learn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

This is an example. We can call rust functions in python scripts by using pyo3 library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published