io_lifetimes

Trait AsHandle

1.63.0 · Source
pub trait AsHandle {
    // Required method
    fn as_handle(&self) -> BorrowedHandle<'_>;
}
Expand description

A trait to borrow the handle from an underlying object.

Required Methods§

1.63.0 · Source

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

Borrows the handle.

§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();

Implementors§

1.63.0 · Source§

impl AsHandle for File

1.63.0 · Source§

impl AsHandle for Stderr

1.63.0 · Source§

impl AsHandle for Stdin

1.63.0 · Source§

impl AsHandle for Stdout

Source§

impl AsHandle for PipeReader

Source§

impl AsHandle for PipeWriter

1.63.0 · Source§

impl AsHandle for Child

1.63.0 · Source§

impl AsHandle for ChildStderr

1.63.0 · Source§

impl AsHandle for ChildStdin

1.63.0 · Source§

impl AsHandle for ChildStdout

1.63.0 · Source§

impl AsHandle for BorrowedHandle<'_>

1.63.0 · Source§

impl AsHandle for OwnedHandle

1.63.0 · Source§

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

1.63.0 · Source§

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

1.63.0 · Source§

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

1.63.0 · Source§

impl<T> AsHandle for &T
where T: AsHandle + ?Sized,

1.63.0 · Source§

impl<T> AsHandle for &mut T
where T: AsHandle + ?Sized,

1.71.0 · Source§

impl<T> AsHandle for Box<T>
where T: AsHandle + ?Sized,

1.71.0 · Source§

impl<T> AsHandle for Rc<T>
where T: AsHandle + ?Sized,

1.71.0 · Source§

impl<T> AsHandle for Arc<T>
where T: AsHandle + ?Sized,

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> {}
1.63.0 · Source§

impl<T> AsHandle for JoinHandle<T>