Skip to content

Releases: daireto/simple-result

v0.2.0

16 Dec 20:14

Choose a tag to compare

0.2.0 (2025-12-16)

Introduces error codes, improved documentation, and expanded test coverage.

Features

  • Error Code Support:
    • Added .code property to both Ok and Err classes.
    • Default codes: 0 for Ok, 1 for Err.
    • Custom error codes can be provided when constructing Err.

Documentation

  • Updated README with:
    • Project status, version, and license badges.
    • Examples showing how to use error codes in pattern matching.
    • Clearer explanation of unwrap_value and unwrap_error.

Tests

  • Added unit tests for .code property:
    • Ensures default values (0 for Ok, 1 for Err).
    • Validates custom error codes.
  • Expanded test coverage for unwrap_value and unwrap_error.

Chores

  • Removed commit message generation instructions.
  • Bumped version to 0.2.0.

Breaking Changes

  • None identified. Existing functionality remains compatible, with new features added.

v0.1.0

17 Nov 00:37

Choose a tag to compare

0.1.0 (2025-11-16)

First release.

Features

  • Result Type Pattern Implementation:

    • Ok[T] - Represents successful values with type safety
    • Err[E] - Represents error values with exception constraints
    • Result[T, E] - Type alias for union of Ok and Err types
  • Core Functionality:

    • .value property - Access the wrapped value (Ok) or None (Err)
    • .error property - Access the wrapped error (Err) or None (Ok)
    • .unwrap_value() method - Extract value or raise UnwrapError if Err
    • .unwrap_error() method - Extract error or raise UnwrapError if Ok
  • Python Integration:

    • Proper __repr__, __eq__, __ne__, __hash__ implementations
    • Boolean evaluation (Ok is truthy, Err is falsy)
    • Pattern matching support via __match_args__
    • isinstance helper with ResultOption tuple
  • Error Handling:

    • Custom UnwrapError exception for unwrap operations
    • Proper exception chaining for Err unwrap_value calls
    • Access to original Result via .result property on UnwrapError
  • Memory Efficiency:

    • __slots__ optimization for reduced memory footprint
    • Minimal object overhead with single _value slot per instance