A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rust-lang/rust/issues/99301 below:

Tracking Issue for `error_generic_member_access` · Issue #99301 · rust-lang/rust · GitHub

Feature gate: #![feature(error_generic_member_access)]

This is a tracking issue for the generic member access API on the error trait, which generalizes the pattern of fn source(&self) -> Option<&dyn Error> and fn backtrace(&self) -> Option<&Backtrace> into fn request_ref::<T>(&self) -> Option<&T>

Public API
// std::error

pub trait Error: Debug + Display {
    // existing API unchanged

    fn provide<'a>(&'a self, req: &mut Demand<'a>) {}
}

impl dyn Error + Send + Sync + 'static { // and all combinations of send/sync
    pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> {
        core::any::request_ref(self)
    }

    pub fn request_value<T: 'static>(&self) -> Option<T> {
        core::any::request_value(self)
    }
}
Steps / History

Now tracked by @waynr in #99301 (comment)

Unresolved Questions

stepancheg, tgross35, thebluetropics, jess-sol, schneiderfelipe and 9 morerobsdedude, adriandelgado, artob, chamons and joseluis


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4