wiki/content/20201119171245-tryinto.md

31 lines
470 B
Markdown

---
date: 20201119
id: ab615a6d-64d5-49a4-824e-a02889a05a8f
title: TryInto
---
# Description
TryInto[^1] is an attempted conversion that consumes self, which may or
may not be expensive.
# Delcaration
``` rust
pub trait TryInto<T> {
type Error;
fn try_into(self) -> Result<T, Self::Error>;
}
```
# Implementors
``` rust
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,
```
# Footnotes
[^1]: <https://doc.rust-lang.org/std/convert/trait.TryInto.html>