Move Sized bound to the IntoContext trait and add with_caller method
This commit is contained in:
parent
457328945c
commit
55054597d1
|
@ -93,16 +93,19 @@ impl fmt::Display for Detail {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait IntoContext {
|
||||
pub trait IntoContext: Sized {
|
||||
fn into_context(self) -> Context;
|
||||
|
||||
#[inline(always)]
|
||||
fn with(self, other: impl IntoContext) -> Context
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
fn with(self, other: impl IntoContext) -> Context {
|
||||
self.into_context().with(other)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
#[track_caller]
|
||||
fn with_caller(self) -> Context {
|
||||
self.with(Location::caller())
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoContext for Context {
|
||||
|
|
Loading…
Reference in New Issue