wiki/content/20201119171245-tryinto.md

32 lines
472 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-19
2024-05-06 20:40:05 +00:00
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>