Trait miri::shims::os_str::EvalContextExt

source ·
pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
Show 16 methods // Provided methods fn read_os_str_from_c_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, &'a OsStr> where 'tcx: 'a { ... } fn read_os_str_from_wide_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, OsString> where 'tcx: 'a { ... } fn write_os_str_to_c_str( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn write_os_str_to_wide_str_helper( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, truncate: bool, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn write_os_str_to_wide_str( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn write_os_str_to_wide_str_truncated( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn alloc_os_str_as_c_str( &mut self, os_str: &OsStr, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer> { ... } fn alloc_os_str_as_wide_str( &mut self, os_str: &OsStr, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer> { ... } fn read_path_from_c_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, Cow<'a, Path>> where 'tcx: 'a { ... } fn read_path_from_wide_str( &self, ptr: Pointer, ) -> InterpResult<'tcx, PathBuf> { ... } fn write_path_to_c_str( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn write_path_to_wide_str( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn write_path_to_wide_str_truncated( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)> { ... } fn alloc_path_as_c_str( &mut self, path: &Path, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer> { ... } fn alloc_path_as_wide_str( &mut self, path: &Path, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer> { ... } fn convert_path<'a>( &self, os_str: Cow<'a, OsStr>, direction: PathConversion, ) -> Cow<'a, OsStr> { ... }
}

Provided Methods§

source

fn read_os_str_from_c_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, &'a OsStr>
where 'tcx: 'a,

Helper function to read an OsString from a null-terminated sequence of bytes, which is what the Unix APIs usually handle.

source

fn read_os_str_from_wide_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, OsString>
where 'tcx: 'a,

Helper function to read an OsString from a 0x0000-terminated sequence of u16, which is what the Windows APIs usually handle.

source

fn write_os_str_to_c_str( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Helper function to write an OsStr as a null-terminated sequence of bytes, which is what the Unix APIs usually handle. Returns (success, full_len), where length includes the null terminator. On failure, nothing is written.

source

fn write_os_str_to_wide_str_helper( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, truncate: bool, ) -> InterpResult<'tcx, (bool, u64)>

Internal helper to share code between write_os_str_to_wide_str and write_os_str_to_wide_str_truncated.

source

fn write_os_str_to_wide_str( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Helper function to write an OsStr as a 0x0000-terminated u16-sequence, which is what the Windows APIs usually handle. Returns (success, full_len), where length is measured in units of u16 and includes the null terminator. On failure, nothing is written.

source

fn write_os_str_to_wide_str_truncated( &mut self, os_str: &OsStr, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Like write_os_str_to_wide_str, but on failure as much as possible is written into the buffer (always with a null terminator).

source

fn alloc_os_str_as_c_str( &mut self, os_str: &OsStr, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer>

Allocate enough memory to store the given OsStr as a null-terminated sequence of bytes.

source

fn alloc_os_str_as_wide_str( &mut self, os_str: &OsStr, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer>

Allocate enough memory to store the given OsStr as a null-terminated sequence of u16.

source

fn read_path_from_c_str<'a>( &'a self, ptr: Pointer, ) -> InterpResult<'tcx, Cow<'a, Path>>
where 'tcx: 'a,

Read a null-terminated sequence of bytes, and perform path separator conversion if needed.

source

fn read_path_from_wide_str(&self, ptr: Pointer) -> InterpResult<'tcx, PathBuf>

Read a null-terminated sequence of u16s, and perform path separator conversion if needed.

source

fn write_path_to_c_str( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Write a Path to the machine memory (as a null-terminated sequence of bytes), adjusting path separators if needed.

source

fn write_path_to_wide_str( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Write a Path to the machine memory (as a null-terminated sequence of u16s), adjusting path separators if needed.

source

fn write_path_to_wide_str_truncated( &mut self, path: &Path, ptr: Pointer, size: u64, ) -> InterpResult<'tcx, (bool, u64)>

Write a Path to the machine memory (as a null-terminated sequence of u16s), adjusting path separators if needed.

source

fn alloc_path_as_c_str( &mut self, path: &Path, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer>

Allocate enough memory to store a Path as a null-terminated sequence of bytes, adjusting path separators if needed.

source

fn alloc_path_as_wide_str( &mut self, path: &Path, memkind: MemoryKind, ) -> InterpResult<'tcx, Pointer>

Allocate enough memory to store a Path as a null-terminated sequence of u16s, adjusting path separators if needed.

source

fn convert_path<'a>( &self, os_str: Cow<'a, OsStr>, direction: PathConversion, ) -> Cow<'a, OsStr>

Implementors§

source§

impl<'tcx> EvalContextExt<'tcx> for MiriInterpCx<'tcx>