useful tools for pygame development
Project description
rust-option
rust-like option type for python
Creation
Creating a None Option:
Option[T].none()
Creating a Some Option:
Option[T].some(value) # type :: Option[type(value)]
Creating an Option from a value of type T | None:
Option[T].new_maybe(value) # will return either a None or Some Option depending on the value.
Usage
Checking for a Some Option:
some_Option = Option[T].some(value)
some_Option.is_some() # returns True
Checking for a None Option:
none_Option = Option[T].none()
none_Option.is_none() # returns True
Getting the value out of an Option:
x = Option[T].some(value)
x.unwrap() # returns value
y = Option[U].none()
y.unwrap_or(value2) # returns value2 as y is a None Option
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rust_option-0.0.3.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rust_option-0.0.3.tar.gz.
File metadata
- Download URL: rust_option-0.0.3.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f597b604f4d27b6af1619feddae4789690428edced5a05cf0022150840c9de7c
|
|
| MD5 |
33afed3b011af847a630b5570c85f83e
|
|
| BLAKE2b-256 |
fdba9b95b93b9b6cc24a3f3fdb83481c018c31a1a6e4572b9f7fcea495126f3c
|
File details
Details for the file rust_option-0.0.3-py3-none-any.whl.
File metadata
- Download URL: rust_option-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c94827ba0e0a26345d9dc89b4e7010548fceb7d1788344c7c629c2c86b59ab77
|
|
| MD5 |
84773d854f7492cb9c6a36753b3809e4
|
|
| BLAKE2b-256 |
249164850d7c6765acf6fbc5241a70a162777eabafdebf30be3f65f6367b47d9
|