pub trait FileDescriptor: Debug + Any {
    // Required methods
    fn name(&self) -> &'static str;
    fn dup(&mut self) -> Result<Box<dyn FileDescriptor>>;

    // Provided methods
    fn read<'tcx>(
        &mut self,
        _communicate_allowed: bool,
        _bytes: &mut [u8],
        _tcx: TyCtxt<'tcx>
    ) -> InterpResult<'tcx, Result<usize>> { ... }
    fn write<'tcx>(
        &self,
        _communicate_allowed: bool,
        _bytes: &[u8],
        _tcx: TyCtxt<'tcx>
    ) -> InterpResult<'tcx, Result<usize>> { ... }
    fn seek<'tcx>(
        &mut self,
        _communicate_allowed: bool,
        _offset: SeekFrom
    ) -> InterpResult<'tcx, Result<u64>> { ... }
    fn close<'tcx>(
        self: Box<Self>,
        _communicate_allowed: bool
    ) -> InterpResult<'tcx, Result<i32>> { ... }
    fn is_tty(&self) -> bool { ... }
    fn as_unix_host_fd(&self) -> Option<i32> { ... }
}

Required Methods§

source

fn name(&self) -> &'static str

source

fn dup(&mut self) -> Result<Box<dyn FileDescriptor>>

Provided Methods§

source

fn read<'tcx>( &mut self, _communicate_allowed: bool, _bytes: &mut [u8], _tcx: TyCtxt<'tcx> ) -> InterpResult<'tcx, Result<usize>>

source

fn write<'tcx>( &self, _communicate_allowed: bool, _bytes: &[u8], _tcx: TyCtxt<'tcx> ) -> InterpResult<'tcx, Result<usize>>

source

fn seek<'tcx>( &mut self, _communicate_allowed: bool, _offset: SeekFrom ) -> InterpResult<'tcx, Result<u64>>

source

fn close<'tcx>( self: Box<Self>, _communicate_allowed: bool ) -> InterpResult<'tcx, Result<i32>>

source

fn is_tty(&self) -> bool

source

fn as_unix_host_fd(&self) -> Option<i32>

Implementations§

source§

impl dyn FileDescriptor

source

pub fn downcast_ref<T: Any>(&self) -> Option<&T>

source

pub fn downcast_mut<T: Any>(&mut self) -> Option<&mut T>

Implementations on Foreign Types§

source§

impl FileDescriptor for Stderr

source§

fn name(&self) -> &'static str

source§

fn write<'tcx>( &self, _communicate_allowed: bool, bytes: &[u8], _tcx: TyCtxt<'tcx> ) -> InterpResult<'tcx, Result<usize>>

source§

fn dup(&mut self) -> Result<Box<dyn FileDescriptor>>

source§

fn as_unix_host_fd(&self) -> Option<i32>

source§

fn is_tty(&self) -> bool

source§

impl FileDescriptor for Stdin

source§

fn name(&self) -> &'static str

source§

fn read<'tcx>( &mut self, communicate_allowed: bool, bytes: &mut [u8], _tcx: TyCtxt<'tcx> ) -> InterpResult<'tcx, Result<usize>>

source§

fn dup(&mut self) -> Result<Box<dyn FileDescriptor>>

source§

fn as_unix_host_fd(&self) -> Option<i32>

source§

fn is_tty(&self) -> bool

source§

impl FileDescriptor for Stdout

source§

fn name(&self) -> &'static str

source§

fn write<'tcx>( &self, _communicate_allowed: bool, bytes: &[u8], _tcx: TyCtxt<'tcx> ) -> InterpResult<'tcx, Result<usize>>

source§

fn dup(&mut self) -> Result<Box<dyn FileDescriptor>>

source§

fn as_unix_host_fd(&self) -> Option<i32>

source§

fn is_tty(&self) -> bool

Implementors§