pub trait FileDescription: Debug + Any {
// Required method
fn name(&self) -> &'static str;
// Provided methods
fn read<'tcx>(
&mut self,
_communicate_allowed: bool,
_bytes: &mut [u8],
_ecx: &mut MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, Result<usize>> { ... }
fn write<'tcx>(
&mut self,
_communicate_allowed: bool,
_bytes: &[u8],
_ecx: &mut MiriInterpCx<'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<()>> { ... }
fn is_tty(&self, _communicate_allowed: bool) -> bool { ... }
}
Expand description
Represents an open file descriptor.
Required Methods§
Provided Methods§
sourcefn read<'tcx>(
&mut self,
_communicate_allowed: bool,
_bytes: &mut [u8],
_ecx: &mut MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, Result<usize>>
fn read<'tcx>( &mut self, _communicate_allowed: bool, _bytes: &mut [u8], _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<usize>>
Reads as much as possible into the given buffer, and returns the number of bytes read.
sourcefn write<'tcx>(
&mut self,
_communicate_allowed: bool,
_bytes: &[u8],
_ecx: &mut MiriInterpCx<'tcx>,
) -> InterpResult<'tcx, Result<usize>>
fn write<'tcx>( &mut self, _communicate_allowed: bool, _bytes: &[u8], _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx, Result<usize>>
Writes as much as possible from the given buffer, and returns the number of bytes written.
sourcefn seek<'tcx>(
&mut self,
_communicate_allowed: bool,
_offset: SeekFrom,
) -> InterpResult<'tcx, Result<u64>>
fn seek<'tcx>( &mut self, _communicate_allowed: bool, _offset: SeekFrom, ) -> InterpResult<'tcx, Result<u64>>
Seeks to the given offset (which can be relative to the beginning, end, or current position). Returns the new position from the start of the stream.