pub trait ResultLiquidExt<T>where
Self: Sized,{
// Required methods
fn trace<S>(self, trace: S) -> Result<T>
where S: Into<Cow<'static, str>>;
fn trace_with<F>(self, trace: F) -> Result<T>
where F: FnOnce() -> Cow<'static, str>;
fn context_key<S>(self, key: S) -> Key<T>
where S: Into<Cow<'static, str>>;
fn context_key_with<F>(self, key: F) -> FnKey<T, F>
where F: FnOnce() -> Cow<'static, str>;
}Expand description
Add context to a liquid_error::Error.
Required Methods§
Sourcefn trace<S>(self, trace: S) -> Result<T>
fn trace<S>(self, trace: S) -> Result<T>
Add a new stack frame to the liquid_error::Error.
§Example
use liquid_error::Error;
use liquid_error::Result;
use liquid_error::ResultLiquidExt;
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error.trace("Within forloop");Sourcefn trace_with<F>(self, trace: F) -> Result<T>
fn trace_with<F>(self, trace: F) -> Result<T>
Add a new stack frame to the liquid_error::Error.
§Example
use liquid_error::Error;
use liquid_error::Result;
use liquid_error::ResultLiquidExt;
let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error.trace_with(|| format!("Within forloop with {}", for_var).into());Sourcefn context_key<S>(self, key: S) -> Key<T>
fn context_key<S>(self, key: S) -> Key<T>
Add state the current stack frame.
§Example
use liquid_error::Error;
use liquid_error::Result;
use liquid_error::ResultLiquidExt;
let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error
.context_key("foo")
.value("10");
let error = error
.context_key("foo")
.value_with(|| format!("{}", for_var).into());Sourcefn context_key_with<F>(self, key: F) -> FnKey<T, F>
fn context_key_with<F>(self, key: F) -> FnKey<T, F>
Add state the current stack frame.
§Example
use liquid_error::Error;
use liquid_error::Result;
use liquid_error::ResultLiquidExt;
let for_var = "foo";
let error: Result<i32> = Err(Error::with_msg("Oops"));
let error = error
.context_key_with(|| format!("{}", 10).into())
.value("10");
let error = error
.context_key_with(|| format!("{}", 10).into())
.value_with(|| format!("{}", for_var).into());Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.