TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Refined: Simple Refinement Types for Rust

4 pointsby pierremenard3 months ago

1 comment

yencabulator3 months ago
I&#x27;m not convinced this is in practice better than a newtype with a hand-written `pub fn new(...)` that returns Option or Result. Sure, you get And&#x2F;Or from the library, but the cognitive overhead is not free!<p>Also, the post talks about how one should prefer parsers over validators, but the library `refined` actually makes you to write validators not parsers: <a href="https:&#x2F;&#x2F;docs.rs&#x2F;refined&#x2F;latest&#x2F;refined&#x2F;trait.Predicate.html" rel="nofollow">https:&#x2F;&#x2F;docs.rs&#x2F;refined&#x2F;latest&#x2F;refined&#x2F;trait.Predicate.html</a> -- the library them combines validatators