Trait std::os::windows::io::AsHandle

1.63.0 · source ·
pub trait AsHandle {
    // Required method
    fn as_handle(&self) -> BorrowedHandle<'_>;
}
Available on Windows only.
Expand description

从底层对象借用句柄的 trait。

Required Methods§

source

fn as_handle(&self) -> BorrowedHandle<'_>

借用句柄。

Example
use std::fs::File;
use std::os::windows::io::{AsHandle, BorrowedHandle};

let mut f = File::open("foo.txt")?;
let borrowed_handle: BorrowedHandle<'_> = f.as_handle();
Run

Implementors§

source§

impl AsHandle for File

source§

impl AsHandle for Stderr

source§

impl AsHandle for Stdin

source§

impl AsHandle for Stdout

source§

impl AsHandle for Child

source§

impl AsHandle for ChildStderr

source§

impl AsHandle for ChildStdin

source§

impl AsHandle for ChildStdout

source§

impl AsHandle for BorrowedHandle<'_>

source§

impl AsHandle for OwnedHandle

source§

impl<'a> AsHandle for StderrLock<'a>

source§

impl<'a> AsHandle for StdinLock<'a>

source§

impl<'a> AsHandle for StdoutLock<'a>

source§

impl<T> AsHandle for JoinHandle<T>

source§

impl<T: AsHandle> AsHandle for &T

source§

impl<T: AsHandle> AsHandle for &mut T

1.71.0 · source§

impl<T: AsHandle> AsHandle for Box<T>

1.71.0 · source§

impl<T: AsHandle> AsHandle for Rc<T>

1.71.0 · source§

impl<T: AsHandle> AsHandle for Arc<T>

这个 impl 允许在 Arc 上实现需要 AsHandle 的 traits。

use std::fs::File;
use std::sync::Arc;

trait MyTrait: AsHandle {}
impl MyTrait for Arc<File> {}
impl MyTrait for Box<File> {}
Run