Use cases for Try

2026-10-14来源 Rust Users ForumEnglish
Use cases for Try

As we move towards stabilising trait Try I'm trying :wink: to collate real-world, actually-implemented, examples.

Anyone who knows of such cases, or has a concrete use case they would like to see, please drop a reply in this thread. For general discussion of Try please start a new thread.

So far, the ones I know about fall into a few categories[1]:

Sidecars

Effectively drop-in replacements for the primary try-types with additional "magic" baked into the Try:

Ergonomics

Orphan rule avoidance

  • exit_safely: create custom return types for main which respond to ? and implement Termination with defined exit codes

Generic over Try

Background


  1. Disclaimer: many of these are my own publications ↩︎

4 posts - 4 participants

Read full topic

原文:https://www.a8q9.cn/en/article/use-cases-for-try-cb81fa.html

相关文章