Skip to main content

A minimal Python adaptation of Rust's Result type

Project description

static_error_handler

A minimal Python adaptation of Rust's Result type. Provides Ok and Err classes with helper methods for error handling.

Installation

Once published on PyPI you can install the library with:

pip install static_error_handler

Usage

from static_error_handler import Ok, Err, Result

def divide(a: int, b: int) -> Result[int, str]:
    if b == 0:
        return Err("division by zero")
    return Ok(a // b)

result = divide(10, 2)
print(result.unwrap())  # 5

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

static_error_handler-0.1.2.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

static_error_handler-0.1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file static_error_handler-0.1.2.tar.gz.

File metadata

  • Download URL: static_error_handler-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for static_error_handler-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ad11614a8cfc6bd4a7c0775a5f745c15b5b5f332054fcea8a8597052f4b223ef
MD5 91c8b45237fad0323590b815042a7c32
BLAKE2b-256 877852954009dc3cb91e709e9c164f092893f97f80d0f1114e29f5c395a7f935

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.2.tar.gz:

Publisher: python-publish.yml on J-joon/static_error_handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file static_error_handler-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for static_error_handler-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 75add57413001eb74dd163a008fdf45e3df54e31e58ba71144e429fdad8da1e2
MD5 0e98afaedf23776d8b8234f41566d748
BLAKE2b-256 1df9e0b03f8205ce77238c8171e5d44b7b3ed555bd5cccce31210753b9f3eda7

See more details on using hashes here.

Provenance

The following attestation bundles were made for static_error_handler-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on J-joon/static_error_handler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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