mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 06:26:22 +00:00
31 lines
455 B
Markdown
31 lines
455 B
Markdown
|
---
|
||
|
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>
|