tap::conv

Trait TryConv

Source
pub trait TryConv
where Self: Sized,
{ // Provided method fn try_conv<T>(self) -> Result<T, Self::Error> where Self: TryInto<T>, T: Sized { ... } }
Expand description

Wraps TryInto::<T>::try_into as a method that can be placed in pipelines.

Provided Methods§

Source

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>, T: Sized,

Attempts to convert self into T using TryInto<T>.

§Examples
use tap::conv::TryConv;

let len = "Saluton, mondo!"
  .try_conv::<String>()
  .unwrap()
  .len();

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.

Implementors§

Source§

impl<T> TryConv for T