Libraries should return Result<T, E> to let callers handle errors, while applications should propagate errors to main and panic on unrecoverable failures.
// Library: Return Result
pub fn summarize(&self) -> Result<String, MyError> {
// logic returning Ok or Err
}
// Application: Propagate to main
fn main() -> Result<(), MyError> {
let article = NewsArticle { /* ... */ };
let summary = article.summarize()?;
println!("New article available! {}", summary);
Ok(())
}