pub trait AsHandle {
// Required method
fn as_handle(&self) -> BorrowedHandle<'_>;
}
A trait to borrow the handle from an underlying object.
fn as_handle(&self) -> BorrowedHandle<'_>
Borrows the handle.
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();impl AsHandle for File
impl AsHandle for PipeReader
impl AsHandle for PipeWriter
impl AsHandle for Stderr
impl AsHandle for Stdin
impl AsHandle for Stdout
impl AsHandle for Child
impl AsHandle for ChildStderr
impl AsHandle for ChildStdin
impl AsHandle for ChildStdout
impl AsHandle for BorrowedHandle<'_>
impl AsHandle for OwnedHandle
impl<'a> AsHandle for StderrLock<'a>
impl<'a> AsHandle for StdinLock<'a>
impl<'a> AsHandle for StdoutLock<'a>
impl<T> AsHandle for JoinHandle<T>
impl<T: AsHandle + ?Sized> AsHandle for &T
impl<T: AsHandle + ?Sized> AsHandle for &mut T
impl<T: AsHandle + ?Sized> AsHandle for Box<T>
impl<T: AsHandle + ?Sized> AsHandle for Rc<T>
impl<T: AsHandle + ?Sized> AsHandle for UniqueRc<T>
impl<T: AsHandle + ?Sized> AsHandle for Arc<T>This impl allows implementing traits that require AsHandle on Arc.
use std::fs::File;
use std::sync::Arc;
trait MyTrait: AsHandle {}
impl MyTrait for Arc<File> {}
impl MyTrait for Box<File> {}
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/windows/io/trait.AsHandle.html