From 72d4bbe9bfc2b6be69103f4421b1b499df182276 Mon Sep 17 00:00:00 2001 From: Alper Cugun <72429+alper@users.noreply.github.com> Date: Sun, 9 Nov 2025 19:35:06 +0100 Subject: [PATCH] Seems like an oversight not to mention this --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index ff83168..7bfdc04 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,16 @@ anyhow = "1.0" Caused by: No such file or directory (os error 2) ``` +- Context also works on Option so you can handle those the same way. + + ```rust + use anyhow::{Context, Result}; + + fn _foo(o: Option) -> Result { + let v = o.context("Oh, boy!")?; + Ok(v) + } + ``` - Downcasting is supported and can be by value, by shared reference, or by mutable reference as needed.