option_result 0.1.0-dev-1 option_result: ^0.1.0-dev-1 copied to clipboard
A lightweight Dart library for Rust-like Option/Result types. Supports exhaustive pattern matching and provides helpers for None()/Err() propagation
0.1.0-dev-1 #
- Add
Option#toString()
- Add
Result#toString()
- Rework
==
forOption
andResult
types.- Previously
==
would check for matching runtime types in addition to held value equality. I was trying to keep things as close to Rust's behavior as I could. It didn't occur to me until after I rewrote it to be more accommodating ofdynamic
values that it didn't support comparing held values that inherit from eachother that might normally be comparable in both the original implementation and the rewrite so I scrapped both in favor of solely comparing held values.
- Previously
0.0.1-dev-9 #
- Add
Result#transpose()
,ok()
,err()
0.0.1-dev-8 #
- Add
Option#unwrapOrElse()
,okOr()
,okOrElse()
,transpose()
- Add
Result#unwrapOrElse()
,isOkAnd()
,isErrAnd()
,mapOr()
,mapOrElse()
0.0.1-dev-7 #
- Add
Option#inspect()
,xor()
,isSomeAnd()
,mapOr()
,mapOrElse()
- Add
Result#inspect()
,inspectErr()
0.0.1-dev-6 #
- Add
Option#flatten()
- Add
Result#flatten()
- Refactor
~
shortcut forpropagateResult/Async
to return dynamic for ergonomics.- See documentation for more information
0.0.1-dev-5 #
- Add
~
operator for unwrappingOption
andResult
types - Add
~
operator as shortcut for propagatingNone()
/Err()
in functions returningOption
/Result
- Rework
Option#unzip()
via extension methods to only provide the method onOption<(T, U)>
values
0.0.1-dev-4 #
- Add
Option#and()
,andThen()
,or()
,orElse()
,expect()
- Add
Result#and()
,andThen()
,or()
,orElse()
,expect()
,expectErr()
0.0.1-dev-3 #
- Add
Option#map()
,zip()
,zipWith()
,unzip()
- Add
Result#map()
,mapErr()
- Reworked
propagateResult/Async
semantics to be more in-line with Rust'sResult
Err
propagation
0.0.1-dev-2 #
- Add separate packages to allow importing
option
andresult
separately - Add
Option#filter()
method
0.0.1-dev-1 #
- Initial version.