URL: https://doc.rust-lang.org/std/process/struct.Child.html
Content-Type: text/html
Method: native

---

---
meta-description: Representation of a running or exited child process.
meta-generator: rustdoc
meta-viewport: width=device-width, initial-scale=1.0
title: Child in std::process - Rust
---
[Skip to main content](#main-content)

## [Child](#)

[std](../index.html)::[process](index.html)

# Struct Child Copy item path

1.0.0 · [Source](../../src/std/process.rs.html#219-257)

```
pub struct Child {
    pub stdin: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStdin](struct.ChildStdin.html "struct std::process::ChildStdin")>,
    pub stdout: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStdout](struct.ChildStdout.html "struct std::process::ChildStdout")>,
    pub stderr: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStderr](struct.ChildStderr.html "struct std::process::ChildStderr")>,
    /* private fields */
}
```

**Expand description**

Representation of a running or exited child process.

This structure is used to represent and manage child processes. A child
process is created via the [`Command`](struct.Command.html "struct std::process::Command") struct, which configures the
spawning process and can itself be constructed using a builder-style
interface.

There is no implementation of [`Drop`](../ops/trait.Drop.html "trait std::ops::Drop") for child processes,
so if you do not ensure the `Child` has exited then it will continue to
run, even after the `Child` handle to the child process has gone out of
scope.

Calling [`wait`](struct.Child.html#method.wait "method std::process::Child::wait") (or other functions that wrap around it) will make
the parent process wait until the child has actually exited before
continuing.

## [§](#warning)Warning

On some systems, calling [`wait`](struct.Child.html#method.wait "method std::process::Child::wait") or similar is necessary for the OS to
release resources. A process that terminated but has not been waited on is
still around as a “zombie”. Leaving too many zombies around may exhaust
global resources (for example process IDs).

The standard library does *not* automatically wait on child processes (not
even if the `Child` is dropped), it is up to the application developer to do
so. As a consequence, dropping `Child` handles without waiting on them first
is not recommended in long-running applications.

## [§](#examples)Examples

[ⓘ](# "This example panics")

```
use std::process::Command;

let mut child = Command::new("/bin/cat")
    .arg("file.txt")
    .spawn()
    .expect("failed to execute child");

let ecode = child.wait().expect("failed to wait on child");

assert!(ecode.success());
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::process::Command;%0A++++%0A++++let+mut+child+=+Command::new(%22/bin/cat%22)%0A++++++++.arg(%22file.txt%22)%0A++++++++.spawn()%0A++++++++.expect(%22failed+to+execute+child%22);%0A++++%0A++++let+ecode+=+child.wait().expect(%22failed+to+wait+on+child%22);%0A++++%0A++++assert!(ecode.success());%0A%7D&edition=2024 "Run code")

## Fields[§](#fields)

[§](#structfield.stdin)`stdin: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStdin](struct.ChildStdin.html "struct std::process::ChildStdin")>`

The handle for writing to the child’s standard input (stdin), if it
has been captured. You might find it helpful to do

[ⓘ](# "This example is not tested")

```
let stdin = child.stdin.take().expect("handle present");
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+stdin+=+child.stdin.take().expect(%22handle+present%22);%0A%7D&edition=2024 "Run code")

to avoid partially moving the `child` and thus blocking yourself from calling
functions on `child` while using `stdin`.

[§](#structfield.stdout)`stdout: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStdout](struct.ChildStdout.html "struct std::process::ChildStdout")>`

The handle for reading from the child’s standard output (stdout), if it
has been captured. You might find it helpful to do

[ⓘ](# "This example is not tested")

```
let stdout = child.stdout.take().expect("handle present");
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+stdout+=+child.stdout.take().expect(%22handle+present%22);%0A%7D&edition=2024 "Run code")

to avoid partially moving the `child` and thus blocking yourself from calling
functions on `child` while using `stdout`.

[§](#structfield.stderr)`stderr: [Option](../option/enum.Option.html "enum std::option::Option")<[ChildStderr](struct.ChildStderr.html "struct std::process::ChildStderr")>`

The handle for reading from the child’s standard error (stderr), if it
has been captured. You might find it helpful to do

[ⓘ](# "This example is not tested")

```
let stderr = child.stderr.take().expect("handle present");
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++let+stderr+=+child.stderr.take().expect(%22handle+present%22);%0A%7D&edition=2024 "Run code")

to avoid partially moving the `child` and thus blocking yourself from calling
functions on `child` while using `stderr`.

## Implementations[§](#implementations)

**[Source](../../src/std/process.rs.html#2322-2494)[§](#impl-Child)

### impl [Child](struct.Child.html "struct std::process::Child")**

**1.0.0 · [Source](../../src/std/process.rs.html#2347-2349)

#### pub fn [kill](#method.kill)(&mut self) -> [Result](../io/type.Result.html "type std::io::Result")<[()](../primitive.unit.html)>**

Forces the child process to exit. If the child has already exited, `Ok(())` is returned.

The mapping to [`ErrorKind`](../io/enum.ErrorKind.html "enum std::io::ErrorKind")s is not part of the compatibility contract of the function.

This is equivalent to sending a SIGKILL on Unix platforms.

##### [§](#examples-1)Examples

```
use std::process::Command;

let mut command = Command::new("yes");
if let Ok(mut child) = command.spawn() {
    child.kill().expect("command couldn't be killed");
} else {
    println!("yes command didn't start");
}
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::process::Command;%0A++++%0A++++let+mut+command+=+Command::new(%22yes%22);%0A++++if+let+Ok(mut+child)+=+command.spawn()+%7B%0A++++++++child.kill().expect(%22command+couldn't+be+killed%22);%0A++++%7D+else+%7B%0A++++++++println!(%22yes+command+didn't+start%22);%0A++++%7D%0A%7D&edition=2024 "Run code")

**1.3.0 · [Source](../../src/std/process.rs.html#2368-2370)

#### pub fn [id](#method.id)(&self) -> [u32](../primitive.u32.html)**

Returns the OS-assigned process identifier associated with this child.

##### [§](#examples-2)Examples

```
use std::process::Command;

let mut command = Command::new("ls");
if let Ok(child) = command.spawn() {
    println!("Child's ID is {}", child.id());
} else {
    println!("ls command didn't start");
}
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::process::Command;%0A++++%0A++++let+mut+command+=+Command::new(%22ls%22);%0A++++if+let+Ok(child)+=+command.spawn()+%7B%0A++++++++println!(%22Child's+ID+is+%7B%7D%22,+child.id());%0A++++%7D+else+%7B%0A++++++++println!(%22ls+command+didn't+start%22);%0A++++%7D%0A%7D&edition=2024 "Run code")

**1.0.0 · [Source](../../src/std/process.rs.html#2395-2398)

#### pub fn [wait](#method.wait)(&mut self) -> [Result](../io/type.Result.html "type std::io::Result")<[ExitStatus](struct.ExitStatus.html "struct std::process::ExitStatus")>**

Waits for the child to exit completely, returning the status that it
exited with. This function will continue to have the same return value
after it has been called at least once.

The stdin handle to the child process, if any, will be closed
before waiting. This helps avoid deadlock: it ensures that the
child does not block waiting for input from the parent, while
the parent waits for the child to exit.

##### [§](#examples-3)Examples

```
use std::process::Command;

let mut command = Command::new("ls");
if let Ok(mut child) = command.spawn() {
    child.wait().expect("command wasn't running");
    println!("Child has finished its execution!");
} else {
    println!("ls command didn't start");
}
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::process::Command;%0A++++%0A++++let+mut+command+=+Command::new(%22ls%22);%0A++++if+let+Ok(mut+child)+=+command.spawn()+%7B%0A++++++++child.wait().expect(%22command+wasn't+running%22);%0A++++++++println!(%22Child+has+finished+its+execution!%22);%0A++++%7D+else+%7B%0A++++++++println!(%22ls+command+didn't+start%22);%0A++++%7D%0A%7D&edition=2024 "Run code")

**1.18.0 · [Source](../../src/std/process.rs.html#2434-2436)

#### pub fn [try_wait](#method.try_wait)(&mut self) -> [Result](../io/type.Result.html "type std::io::Result")<[Option](../option/enum.Option.html "enum std::option::Option")<[ExitStatus](struct.ExitStatus.html "struct std::process::ExitStatus")>>**

Attempts to collect the exit status of the child if it has already
exited.

This function will not block the calling thread and will only
check to see if the child process has exited or not. If the child has
exited then on Unix the process ID is reaped. This function is
guaranteed to repeatedly return a successful exit status so long as the
child has already exited.

If the child has exited, then `Ok(Some(status))` is returned. If the
exit status is not available at this time then `Ok(None)` is returned.
If an error occurs, then that error is returned.

Note that unlike `wait`, this function will not attempt to drop stdin.

##### [§](#examples-4)Examples

```
use std::process::Command;

let mut child = Command::new("ls").spawn()?;

match child.try_wait() {
    Ok(Some(status)) => println!("exited with: {status}"),
    Ok(None) => {
        println!("status not ready yet, let's really wait");
        let res = child.wait();
        println!("result: {res:?}");
    }
    Err(e) => println!("error attempting to wait: {e}"),
}
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B+fn+_inner()+-%3E+core::result::Result%3C(),+impl+core::fmt::Debug%3E+%7B%0A++++use+std::process::Command;%0A++++%0A++++let+mut+child+=+Command::new(%22ls%22).spawn()?;%0A++++%0A++++match+child.try_wait()+%7B%0A++++++++Ok(Some(status))+=%3E+println!(%22exited+with:+%7Bstatus%7D%22),%0A++++++++Ok(None)+=%3E+%7B%0A++++++++++++println!(%22status+not+ready+yet,+let's+really+wait%22);%0A++++++++++++let+res+=+child.wait();%0A++++++++++++println!(%22result:+%7Bres:?%7D%22);%0A++++++++%7D%0A++++++++Err(e)+=%3E+println!(%22error+attempting+to+wait:+%7Be%7D%22),%0A++++%7D%0A++++std::io::Result::Ok(())%0A%7D+_inner().unwrap()+%7D&edition=2024 "Run code")

**1.0.0 · [Source](../../src/std/process.rs.html#2471-2493)

#### pub fn [wait_with_output](#method.wait_with_output)(self) -> [Result](../io/type.Result.html "type std::io::Result")<[Output](struct.Output.html "struct std::process::Output")>**

Simultaneously waits for the child to exit and collect all remaining
output on the stdout/stderr handles, returning an `Output` instance.

The stdin handle to the child process, if any, will be closed
before waiting. This helps avoid deadlock: it ensures that the
child does not block waiting for input from the parent, while
the parent waits for the child to exit.

By default, stdin, stdout and stderr are inherited from the parent.
In order to capture the output into this `Result<Output>` it is
necessary to create new pipes between parent and child. Use `stdout(Stdio::piped())` or `stderr(Stdio::piped())`, respectively.

##### [§](#examples-5)Examples

[ⓘ](# "This example panics")

```
use std::process::{Command, Stdio};

let child = Command::new("/bin/cat")
    .arg("file.txt")
    .stdout(Stdio::piped())
    .spawn()
    .expect("failed to execute child");

let output = child
    .wait_with_output()
    .expect("failed to wait on child");

assert!(output.status.success());
```

[](https://play.rust-lang.org/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++use+std::process::%7BCommand,+Stdio%7D;%0A++++%0A++++let+child+=+Command::new(%22/bin/cat%22)%0A++++++++.arg(%22file.txt%22)%0A++++++++.stdout(Stdio::piped())%0A++++++++.spawn()%0A++++++++.expect(%22failed+to+execute+child%22);%0A++++%0A++++let+output+=+child%0A++++++++.wait_with_output()%0A++++++++.expect(%22failed+to+wait+on+child%22);%0A++++%0A++++assert!(output.status.success());%0A%7D&edition=2024 "Run code")

## Trait Implementations[§](#trait-implementations)

**1.63.0 · [Source](../../src/std/os/windows/process.rs.html#44-49)[§](#impl-AsHandle-for-Child)

### impl [AsHandle](../os/windows/io/trait.AsHandle.html "trait std::os::windows::io::AsHandle") for [Child](struct.Child.html "struct std::process::Child")

Available on Windows only.**

**[Source](../../src/std/os/windows/process.rs.html#46-48)[§](#method.as_handle)

#### fn [as_handle](../os/windows/io/trait.AsHandle.html#tymethod.as_handle)(&self) -> [BorrowedHandle](../os/windows/io/struct.BorrowedHandle.html "struct std::os::windows::io::BorrowedHandle")<'_>**

Borrows the handle. [Read more](../os/windows/io/trait.AsHandle.html#tymethod.as_handle)

**1.2.0 · [Source](../../src/std/os/windows/process.rs.html#36-41)[§](#impl-AsRawHandle-for-Child)

### impl [AsRawHandle](../os/windows/io/trait.AsRawHandle.html "trait std::os::windows::io::AsRawHandle") for [Child](struct.Child.html "struct std::process::Child")

Available on Windows only.**

**[Source](../../src/std/os/windows/process.rs.html#38-40)[§](#method.as_raw_handle)

#### fn [as_raw_handle](../os/windows/io/trait.AsRawHandle.html#tymethod.as_raw_handle)(&self) -> [RawHandle](../os/windows/io/type.RawHandle.html "type std::os::windows::io::RawHandle")**

Extracts the raw handle. [Read more](../os/windows/io/trait.AsRawHandle.html#tymethod.as_raw_handle)

**[Source](../../src/std/os/unix/process.rs.html#559-580)[§](#impl-ChildExt-for-Child)

### impl [ChildExt](../os/unix/process/trait.ChildExt.html "trait std::os::unix::process::ChildExt") for [Child](struct.Child.html "struct std::process::Child")

Available on Unix only.**

**[Source](../../src/std/os/unix/process.rs.html#560-562)[§](#method.send_signal)

#### fn [send_signal](../os/unix/process/trait.ChildExt.html#tymethod.send_signal)(&self, signal: [i32](../primitive.i32.html)) -> [Result](../io/type.Result.html "type std::io::Result")<[()](../primitive.unit.html)>**

🔬This is a nightly-only experimental API. (`unix_send_signal` [#141975](https://github.com/rust-lang/rust/issues/141975))

Sends a signal to a child process. [Read more](../os/unix/process/trait.ChildExt.html#tymethod.send_signal)

**[Source](../../src/std/os/unix/process.rs.html#564-566)[§](#method.send_process_group_signal)

#### fn [send_process_group_signal](../os/unix/process/trait.ChildExt.html#tymethod.send_process_group_signal)(&self, signal: [i32](../primitive.i32.html)) -> [Result](../io/type.Result.html "type std::io::Result")<[()](../primitive.unit.html)>**

🔬This is a nightly-only experimental API. (`unix_send_signal` [#141975](https://github.com/rust-lang/rust/issues/141975))

Sends a signal to a child process’s process group. [Read more](../os/unix/process/trait.ChildExt.html#tymethod.send_process_group_signal)

**[Source](../../src/std/os/unix/process.rs.html#569-571)[§](#method.kill_process_group)

#### fn [kill_process_group](../os/unix/process/trait.ChildExt.html#tymethod.kill_process_group)(&mut self) -> [Result](../io/type.Result.html "type std::io::Result")<[()](../primitive.unit.html)>**

🔬This is a nightly-only experimental API. (`unix_kill_process_group` [#156537](https://github.com/rust-lang/rust/issues/156537))

Forces the child process’s process group to exit. [Read more](../os/unix/process/trait.ChildExt.html#tymethod.kill_process_group)

**[Source](../../src/std/os/windows/process.rs.html#446-450)[§](#impl-ChildExt-for-Child-1)

### impl [ChildExt](../os/windows/process/trait.ChildExt.html "trait std::os::windows::process::ChildExt") for [Child](struct.Child.html "struct std::process::Child")

Available on Windows only.**

**[Source](../../src/std/os/windows/process.rs.html#447-449)[§](#method.main_thread_handle)

#### fn [main_thread_handle](../os/windows/process/trait.ChildExt.html#tymethod.main_thread_handle)(&self) -> [BorrowedHandle](../os/windows/io/struct.BorrowedHandle.html "struct std::os::windows::io::BorrowedHandle")<'_>**

🔬This is a nightly-only experimental API. (`windows_process_extensions_main_thread_handle` [#96723](https://github.com/rust-lang/rust/issues/96723))

Extracts the main thread raw handle, without taking ownership

**[Source](../../src/std/sys/process/unix/unix.rs.html#1299-1316)[§](#impl-ChildExt-for-Child-2)

### impl [ChildExt](../os/linux/process/trait.ChildExt.html "trait std::os::linux::process::ChildExt") for [Child](struct.Child.html "struct std::process::Child")

Available on Linux only.**

**[Source](../../src/std/sys/process/unix/unix.rs.html#1300-1307)[§](#method.pidfd)

#### fn [pidfd](../os/linux/process/trait.ChildExt.html#tymethod.pidfd)(&self) -> [Result](../io/type.Result.html "type std::io::Result")<&[PidFd](../os/linux/process/struct.PidFd.html "struct std::os::linux::process::PidFd")>**

🔬This is a nightly-only experimental API. (`linux_pidfd` [#82971](https://github.com/rust-lang/rust/issues/82971))

Obtains a reference to the [`PidFd`](../os/linux/process/struct.PidFd.html "struct std::os::linux::process::PidFd") created for this [`Child`](struct.Child.html "struct std::process::Child"), if available. [Read more](../os/linux/process/trait.ChildExt.html#tymethod.pidfd)

**[Source](../../src/std/sys/process/unix/unix.rs.html#1309-1315)[§](#method.into_pidfd)

#### fn [into_pidfd](../os/linux/process/trait.ChildExt.html#tymethod.into_pidfd)(self) -> [Result](../result/enum.Result.html "enum std::result::Result")<[PidFd](../os/linux/process/struct.PidFd.html "struct std::os::linux::process::PidFd"), Self>**

🔬This is a nightly-only experimental API. (`linux_pidfd` [#82971](https://github.com/rust-lang/rust/issues/82971))

Returns the [`PidFd`](../os/linux/process/trait.ChildExt.html#tymethod.pidfd "method std::os::linux::process::ChildExt::pidfd") created for this [`Child`](struct.Child.html "struct std::process::Child"), if available.
Otherwise self is returned. [Read more](../os/linux/process/trait.ChildExt.html#tymethod.into_pidfd)

**1.16.0 · [Source](../../src/std/process.rs.html#284-292)[§](#impl-Debug-for-Child)

### impl [Debug](../fmt/trait.Debug.html "trait std::fmt::Debug") for [Child](struct.Child.html "struct std::process::Child")**

**[Source](../../src/std/process.rs.html#285-291)[§](#method.fmt)

#### fn [fmt](../fmt/trait.Debug.html#tymethod.fmt)(&self, f: &mut [Formatter](../fmt/struct.Formatter.html "struct std::fmt::Formatter")<'_>) -> [Result](../fmt/type.Result.html "type std::fmt::Result")**

Formats the value using the given formatter. [Read more](../fmt/trait.Debug.html#tymethod.fmt)

**1.63.0 · [Source](../../src/std/os/windows/process.rs.html#59-64)[§](#impl-From%3CChild%3E-for-OwnedHandle)

### impl [From](../convert/trait.From.html "trait std::convert::From")<[Child](struct.Child.html "struct std::process::Child")> for [OwnedHandle](../os/windows/io/struct.OwnedHandle.html "struct std::os::windows::io::OwnedHandle")

Available on Windows only.**

**[Source](../../src/std/os/windows/process.rs.html#61-63)[§](#method.from)

#### fn [from](../convert/trait.From.html#tymethod.from)(child: [Child](struct.Child.html "struct std::process::Child")) -> [OwnedHandle](../os/windows/io/struct.OwnedHandle.html "struct std::os::windows::io::OwnedHandle")**

Takes ownership of a [`Child`](struct.Child.html "struct std::process::Child")’s process handle.

**1.4.0 · [Source](../../src/std/os/windows/process.rs.html#52-56)[§](#impl-IntoRawHandle-for-Child)

### impl [IntoRawHandle](../os/windows/io/trait.IntoRawHandle.html "trait std::os::windows::io::IntoRawHandle") for [Child](struct.Child.html "struct std::process::Child")

Available on Windows only.**

**[Source](../../src/std/os/windows/process.rs.html#53-55)[§](#method.into_raw_handle)

#### fn [into_raw_handle](../os/windows/io/trait.IntoRawHandle.html#tymethod.into_raw_handle)(self) -> [RawHandle](../os/windows/io/type.RawHandle.html "type std::os::windows::io::RawHandle")**

Consumes this object, returning the raw underlying handle. [Read more](../os/windows/io/trait.IntoRawHandle.html#tymethod.into_raw_handle)

## Auto Trait Implementations[§](#synthetic-implementations)

[§](#impl-Freeze-for-Child)

### impl [Freeze](../marker/trait.Freeze.html "trait std::marker::Freeze") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-RefUnwindSafe-for-Child)

### impl [RefUnwindSafe](../panic/trait.RefUnwindSafe.html "trait std::panic::RefUnwindSafe") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-Send-for-Child)

### impl [Send](../marker/trait.Send.html "trait std::marker::Send") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-Sync-for-Child)

### impl [Sync](../marker/trait.Sync.html "trait std::marker::Sync") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-Unpin-for-Child)

### impl [Unpin](../marker/trait.Unpin.html "trait std::marker::Unpin") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-UnsafeUnpin-for-Child)

### impl [UnsafeUnpin](../marker/trait.UnsafeUnpin.html "trait std::marker::UnsafeUnpin") for [Child](struct.Child.html "struct std::process::Child")

[§](#impl-UnwindSafe-for-Child)

### impl [UnwindSafe](../panic/trait.UnwindSafe.html "trait std::panic::UnwindSafe") for [Child](struct.Child.html "struct std::process::Child")

## Blanket Implementations[§](#blanket-implementations)

**[Source](../../src/core/any.rs.html#141)[§](#impl-Any-for-T)

### impl<T> [Any](../any/trait.Any.html "trait std::any::Any") for Twhere T: 'static + ?[Sized](../marker/trait.Sized.html "trait std::marker::Sized"),**

**[Source](../../src/core/any.rs.html#142)[§](#method.type_id)

#### fn [type_id](../any/trait.Any.html#tymethod.type_id)(&self) -> [TypeId](../any/struct.TypeId.html "struct std::any::TypeId")**

Gets the `TypeId` of `self`. [Read more](../any/trait.Any.html#tymethod.type_id)

**[Source](../../src/core/borrow.rs.html#212)[§](#impl-Borrow%3CT%3E-for-T)

### impl<T> [Borrow](../borrow/trait.Borrow.html "trait std::borrow::Borrow")<T> for Twhere T: ?[Sized](../marker/trait.Sized.html "trait std::marker::Sized"),**

**[Source](../../src/core/borrow.rs.html#214)[§](#method.borrow)

#### fn [borrow](../borrow/trait.Borrow.html#tymethod.borrow)(&self) -> [&T](../primitive.reference.html)**

Immutably borrows from an owned value. [Read more](../borrow/trait.Borrow.html#tymethod.borrow)

**[Source](../../src/core/borrow.rs.html#221)[§](#impl-BorrowMut%3CT%3E-for-T)

### impl<T> [BorrowMut](../borrow/trait.BorrowMut.html "trait std::borrow::BorrowMut")<T> for Twhere T: ?[Sized](../marker/trait.Sized.html "trait std::marker::Sized"),**

**[Source](../../src/core/borrow.rs.html#222)[§](#method.borrow_mut)

#### fn [borrow_mut](../borrow/trait.BorrowMut.html#tymethod.borrow_mut)(&mut self) -> [&mut T](../primitive.reference.html)**

Mutably borrows from an owned value. [Read more](../borrow/trait.BorrowMut.html#tymethod.borrow_mut)

**[Source](../../src/core/convert/mod.rs.html#787)[§](#impl-From%3CT%3E-for-T)

### impl<T> [From](../convert/trait.From.html "trait std::convert::From")<T> for T**

**[Source](../../src/core/convert/mod.rs.html#790)[§](#method.from-1)

#### fn [from](../convert/trait.From.html#tymethod.from)(t: T) -> T**

Returns the argument unchanged.

**[Source](../../src/core/convert/mod.rs.html#769-771)[§](#impl-Into%3CU%3E-for-T)

### impl<T, U> [Into](../convert/trait.Into.html "trait std::convert::Into")<U> for Twhere U: [From](../convert/trait.From.html "trait std::convert::From")<T>,**

**[Source](../../src/core/convert/mod.rs.html#779)[§](#method.into)

#### fn [into](../convert/trait.Into.html#tymethod.into)(self) -> U**

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `[From](../convert/trait.From.html "trait std::convert::From")<T> for U` chooses to do.

**[Source](../../src/core/convert/mod.rs.html#829-831)[§](#impl-TryFrom%3CU%3E-for-T)

### impl<T, U> [TryFrom](../convert/trait.TryFrom.html "trait std::convert::TryFrom")<U> for Twhere U: [Into](../convert/trait.Into.html "trait std::convert::Into")<T>,**

**[Source](../../src/core/convert/mod.rs.html#833)[§](#associatedtype.Error)

#### type [Error](../convert/trait.TryFrom.html#associatedtype.Error) = [Infallible](../convert/enum.Infallible.html "enum std::convert::Infallible")**

The type returned in the event of a conversion error.

**[Source](../../src/core/convert/mod.rs.html#836)[§](#method.try_from)

#### fn [try_from](../convert/trait.TryFrom.html#tymethod.try_from)(value: U) -> [Result](../result/enum.Result.html "enum std::result::Result")<T, <T as [TryFrom](../convert/trait.TryFrom.html "trait std::convert::TryFrom")<U>>::[Error](../convert/trait.TryFrom.html#associatedtype.Error "type std::convert::TryFrom::Error")>**

Performs the conversion.

**[Source](../../src/core/convert/mod.rs.html#813-815)[§](#impl-TryInto%3CU%3E-for-T)

### impl<T, U> [TryInto](../convert/trait.TryInto.html "trait std::convert::TryInto")<U> for Twhere U: [TryFrom](../convert/trait.TryFrom.html "trait std::convert::TryFrom")<T>,**

**[Source](../../src/core/convert/mod.rs.html#817)[§](#associatedtype.Error-1)

#### type [Error](../convert/trait.TryInto.html#associatedtype.Error) = <U as [TryFrom](../convert/trait.TryFrom.html "trait std::convert::TryFrom")<T>>::[Error](../convert/trait.TryFrom.html#associatedtype.Error "type std::convert::TryFrom::Error")**

The type returned in the event of a conversion error.

**[Source](../../src/core/convert/mod.rs.html#820)[§](#method.try_into)

#### fn [try_into](../convert/trait.TryInto.html#tymethod.try_into)(self) -> [Result](../result/enum.Result.html "enum std::result::Result")<U, <U as [TryFrom](../convert/trait.TryFrom.html "trait std::convert::TryFrom")<T>>::[Error](../convert/trait.TryFrom.html#associatedtype.Error "type std::convert::TryFrom::Error")>**

Performs the conversion.