Releases: daireto/simple-result
Releases · daireto/simple-result
v0.2.0
0.2.0 (2025-12-16)
Introduces error codes, improved documentation, and expanded test coverage.
Features
- Error Code Support:
- Added
.codeproperty to bothOkandErrclasses. - Default codes:
0forOk,1forErr. - Custom error codes can be provided when constructing
Err.
- Added
Documentation
- Updated README with:
- Project status, version, and license badges.
- Examples showing how to use error codes in pattern matching.
- Clearer explanation of
unwrap_valueandunwrap_error.
Tests
- Added unit tests for
.codeproperty:- Ensures default values (
0forOk,1forErr). - Validates custom error codes.
- Ensures default values (
- Expanded test coverage for
unwrap_valueandunwrap_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
0.1.0 (2025-11-16)
First release.
Features
-
Result Type Pattern Implementation:
Ok[T]- Represents successful values with type safetyErr[E]- Represents error values with exception constraintsResult[T, E]- Type alias for union of Ok and Err types
-
Core Functionality:
.valueproperty - Access the wrapped value (Ok) or None (Err).errorproperty - 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__ isinstancehelper withResultOptiontuple
- Proper
-
Error Handling:
- Custom
UnwrapErrorexception for unwrap operations - Proper exception chaining for Err unwrap_value calls
- Access to original Result via
.resultproperty on UnwrapError
- Custom
-
Memory Efficiency:
__slots__optimization for reduced memory footprint- Minimal object overhead with single
_valueslot per instance