-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from dtolnay/errorprovide
Update to nightly's new Error::provide API
- Loading branch information
Showing
6 changed files
with
78 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
use std::any::{Demand, Provider}; | ||
use std::error::{Error, Request}; | ||
|
||
pub trait ThiserrorProvide: Sealed { | ||
fn thiserror_provide<'a>(&'a self, demand: &mut Demand<'a>); | ||
fn thiserror_provide<'a>(&'a self, request: &mut Request<'a>); | ||
} | ||
|
||
impl<T: Provider + ?Sized> ThiserrorProvide for T { | ||
impl<T> ThiserrorProvide for T | ||
where | ||
T: Error + ?Sized, | ||
{ | ||
#[inline] | ||
fn thiserror_provide<'a>(&'a self, demand: &mut Demand<'a>) { | ||
self.provide(demand); | ||
fn thiserror_provide<'a>(&'a self, request: &mut Request<'a>) { | ||
self.provide(request); | ||
} | ||
} | ||
|
||
pub trait Sealed {} | ||
impl<T: Provider + ?Sized> Sealed for T {} | ||
impl<T: Error + ?Sized> Sealed for T {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters