partial

Optional monad with fake variant

10 unstable releases (3 breaking)

Uses old Rust 2015

0.4.0 Jul 24, 2018
0.3.0 Jul 24, 2018
0.2.3 Aug 30, 2017
0.1.3 Mar 2, 2017
0.1.0 Oct 12, 2016

#1279 in Data structures

Download history 17/week @ 2024-09-22 1/week @ 2024-09-29

69 downloads per month
Used in oak

Apache-2.0

10KB
227 lines

Partial library

ptal on Travis CI

Similar to Option<T> with an additional Fake variant for accumulating errors beyond the first one. For example, in compiler, if a code analysis failed, we wish to continue a little further to obtain more errors.

Please consult the documentation.


lib.rs:

Partial is similar to Option where Value replaces Some and Nothing replaces None.

Similarly to Value, Fake contains a value of the right type that can be further used (e.g. in map or and_then) but this value is a dummy value used to be able to compute the rest and detect more errors. For any method, we have the ordering: Value > Fake > Nothing; a Fake value will never be a Value again.

Use case: When compiling, an error in one function must be reported but should not prevent the compilation of a second function to detect more errors in one run. This intermediate state is represented by Fake.

No runtime deps