Skip to main content

A Rust toolkit library for python which allows you to write rust-like code in python.

Project description

Rustkit - A Python library for Rust lovers.

Rustkit is a Python library for Rust lovers. It provides a set of tools to write Rust-like code in Python. It's written by a fellow rustacean, who also loves Python. In my opinion, Python is a great language, but it lacks some features that Rust has. Rustkit is an attempt to bring some of those features to Python.

Roadmap

as of now, only the following features are implemented:

  • Result
  • Option

with these features on their way in a future release:

  • Vector
  • Iterators

Installation

pip install rustkit

Usage

from rustkit import *

# Rust-like optionals
assert some(10).unwrap() == 10
assert some(10).unwrap_or(20) == 10
assert Option.from_(None) == NONE

# Rust-like results, and error handlers
assert ok(10).unwrap() == 10
assert ok(10).unwrap_or(20) == 10
assert Result.from_(lambda: 10 / 0) == err(ZeroDivisionError)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustkit-0.0.2.tar.gz (21.7 kB view details)

Uploaded Source

File details

Details for the file rustkit-0.0.2.tar.gz.

File metadata

  • Download URL: rustkit-0.0.2.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for rustkit-0.0.2.tar.gz
Algorithm Hash digest
SHA256 3f04a1d6da59538e7e024053670ceb0351fc505c8ba1df96fe433e45f190d593
MD5 5130c343e63edfa040e27469c01947b5
BLAKE2b-256 0d5b8cfa06181b5f65caf46c1da11d643afc4604fce9ed430dd6f4864c685a19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page