Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ddjerqq/rustkit
Rustkit - A Python library for Rust lovers who want to use Rust-like code in Python.
https://github.com/ddjerqq/rustkit
Last synced: about 6 hours ago
JSON representation
Rustkit - A Python library for Rust lovers who want to use Rust-like code in Python.
- Host: GitHub
- URL: https://github.com/ddjerqq/rustkit
- Owner: ddjerqq
- License: gpl-2.0
- Created: 2022-12-15T00:12:22.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T16:11:58.000Z (over 1 year ago)
- Last Synced: 2024-08-08T17:17:15.119Z (3 months ago)
- Language: Python
- Size: 66.4 KB
- Stars: 8
- Watchers: 0
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
- [x] Result
- [x] Option#### with these features on their way in a future release:
- [ ] Vector
- [ ] Iterators## Installation
```bash
pip install rustkit
```## Usage
```python
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)
```