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.2.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.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rust_option-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 9bb1010aa5ce0baa14a05ff2c3d55532c6b8ffba3fcdee5eeec85e0c53fd55f6
MD5 552dd32eb07a2c67004a07e88b64db55
BLAKE2b-256 16bc581600388796bcaae048d0e8a1d22a57e0df091010bcade6cd5dd2039c3c

See more details on using hashes here.

File details

Details for the file rust_option-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: rust_option-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b8008634c0d3e69a896246197620a2e840864f660f0276a5a261c253782ed3e1
MD5 e19365a79fb668f35591a45766669a4b
BLAKE2b-256 fddd89448ccf9f16c65fd2ef5e441f6408049aac4c6f20b95a813e0399c727cd

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