[−][src]Trait liquid_value::error::ResultLiquidReplaceExt
Result
extension methods for adapting third party errors to Error
.
Required methods
#[must_use]
fn lossy_chain<S>(self, msg: S) -> Result<T, Error> where
S: Into<Cow<'static, str>>,
S: Into<Cow<'static, str>>,
Create an Error
ignoring E
as the cause.
Example
use std::io; use liquid_error::Result; use liquid_error::ResultLiquidReplaceExt; let error = Err(io::Error::new(io::ErrorKind::NotFound, "Oops")); let error: Result<i32> = error.lossy_chain("Missing liquid partial");
#[must_use]
fn lossy_chain_with<F>(self, msg: F) -> Result<T, Error> where
F: FnOnce() -> Cow<'static, str>,
F: FnOnce() -> Cow<'static, str>,
Create an Error
ignoring E
as the cause.
Example
use std::io; use liquid_error::Result; use liquid_error::ResultLiquidReplaceExt; let filename = "foo"; let error = Err(io::Error::new(io::ErrorKind::NotFound, "Oops")); let error: Result<i32> = error .lossy_chain_with(|| format!("Missing liquid partial: {}", filename).into());
#[must_use]
fn replace<S>(self, msg: S) -> Result<T, Error> where
S: Into<Cow<'static, str>>,
S: Into<Cow<'static, str>>,
Create an Error
ignoring E
as the cause.
Example
use std::io; use liquid_error::Result; use liquid_error::ResultLiquidReplaceExt; let error = Err(io::Error::new(io::ErrorKind::NotFound, "Oops")); let error: Result<i32> = error.replace("Missing liquid partial");
#[must_use]
fn replace_with<F>(self, msg: F) -> Result<T, Error> where
F: FnOnce() -> Cow<'static, str>,
F: FnOnce() -> Cow<'static, str>,
Create an Error
ignoring E
as the cause.
Example
use std::io; use liquid_error::Result; use liquid_error::ResultLiquidReplaceExt; let filename = "foo"; let error = Err(io::Error::new(io::ErrorKind::NotFound, "Oops")); let error: Result<i32> = error .replace_with(|| format!("Missing liquid partial: {}", filename).into());
Implementations on Foreign Types
impl<T, E> ResultLiquidReplaceExt<T> for Result<T, E> where
E: Error + Send + Sync + 'static,
[src]
E: Error + Send + Sync + 'static,
fn lossy_chain<S>(self, msg: S) -> Result<T, Error> where
S: Into<Cow<'static, str>>,
[src]
S: Into<Cow<'static, str>>,
fn lossy_chain_with<F>(self, msg: F) -> Result<T, Error> where
F: FnOnce() -> Cow<'static, str>,
[src]
F: FnOnce() -> Cow<'static, str>,
fn replace<S>(self, msg: S) -> Result<T, Error> where
S: Into<Cow<'static, str>>,
[src]
S: Into<Cow<'static, str>>,
fn replace_with<F>(self, msg: F) -> Result<T, Error> where
F: FnOnce() -> Cow<'static, str>,
[src]
F: FnOnce() -> Cow<'static, str>,