pytype 0.1.1

A Python type module for Rust
Documentation
  • Coverage
  • 0%
    0 out of 19 items documented0 out of 12 items with examples
  • Size
  • Source code size: 3.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.71 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pymainprocess

pytype

What is pytype.

Pytype is an pyo3 extension module for rust, with many Types for Python Extension Module workings.

For Example

use pytype::{PyInt, PyFloat, PyList, PyDict};
use pyo3::prelude::*;

/// Not to the Differences
/// Maybe you make Following Function
#[pyfunction]
fn add(a: PyFloat, b: PyFloat) -> PyResult<PyFloat> {
    Ok(a + b)
}

The Thing is, generally is the Type an normal Rust type, but with Better Working.

So is PyInt different on 32 bit arches and 64 bit arches.

32 bit

#[cfg(target_point_width = "32")]
pub type PyInt = i32;

64 bit

#[cfg(target_point_width = "64")]
pub type PyInt = i64;

Why you want do that?

Generally you want a Best Perfomance Python Module with best work on any arches.

'i64' can be very slower on 32 bit arches, but 'i32' is very fast on there. 64 bit arches can be work better with 'i64' and will work with that.

The Same is on PyFloat.

32 bit

#[cfg(target_point_width = "32")]
pub type PyFloat = f32;

64 bit

#[cfg(target_point_width = "64")]
pub type PyFloat = f64;