mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 11:36:23 +00:00
31 lines
472 B
Markdown
31 lines
472 B
Markdown
---
|
|
date: 2020-11-19
|
|
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>
|