refinement icon indicating copy to clipboard operation
refinement copied to clipboard

Add a constructor `Refinement::try_new`

Open 8573 opened this issue 3 years ago • 0 comments

Add a constructor Refinement::try_new that returns the original input value if it does not satisfy the predicate, rather than discarding the input value in that case as does Refinement::new.

This could be useful if the input value is expensive or impossible to reconstruct and is wanted even if it does not satisfy the predicate (for example, to report an error).

I believe this change raises the library's minimum supported Rust version (MSRV) from 1.31 to 1.34. Rust 1.34 is supported by distributions including Debian oldoldstable.

8573 avatar Nov 09 '22 06:11 8573