Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rust_option-0.0.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for rust_option-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f597b604f4d27b6af1619feddae4789690428edced5a05cf0022150840c9de7c
MD5 33afed3b011af847a630b5570c85f83e
BLAKE2b-256 fdba9b95b93b9b6cc24a3f3fdb83481c018c31a1a6e4572b9f7fcea495126f3c

See more details on using hashes here.

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

Hashes for rust_option-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c94827ba0e0a26345d9dc89b4e7010548fceb7d1788344c7c629c2c86b59ab77
MD5 84773d854f7492cb9c6a36753b3809e4
BLAKE2b-256 249164850d7c6765acf6fbc5241a70a162777eabafdebf30be3f65f6367b47d9

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