Trait miri::shims::os_str::EvalContextExt
source · pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
Show 13 methods
// Provided methods
fn read_os_str_from_c_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, &'a OsStr>
where 'tcx: 'a,
'mir: 'a { ... }
fn read_os_str_from_wide_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, OsString>
where 'tcx: 'a,
'mir: 'a { ... }
fn write_os_str_to_c_str(
&mut self,
os_str: &OsStr,
ptr: Pointer<Option<Provenance>>,
size: u64
) -> InterpResult<'tcx, (bool, u64)> { ... }
fn write_os_str_to_wide_str(
&mut self,
os_str: &OsStr,
ptr: Pointer<Option<Provenance>>,
size: u64,
truncate: bool
) -> InterpResult<'tcx, (bool, u64)> { ... }
fn alloc_os_str_as_c_str(
&mut self,
os_str: &OsStr,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn alloc_os_str_as_wide_str(
&mut self,
os_str: &OsStr,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn read_path_from_c_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, Cow<'a, Path>>
where 'tcx: 'a,
'mir: 'a { ... }
fn read_path_from_wide_str(
&self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, PathBuf> { ... }
fn write_path_to_c_str(
&mut self,
path: &Path,
ptr: Pointer<Option<Provenance>>,
size: u64
) -> InterpResult<'tcx, (bool, u64)> { ... }
fn write_path_to_wide_str(
&mut self,
path: &Path,
ptr: Pointer<Option<Provenance>>,
size: u64,
truncate: bool
) -> InterpResult<'tcx, (bool, u64)> { ... }
fn alloc_path_as_c_str(
&mut self,
path: &Path,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn alloc_path_as_wide_str(
&mut self,
path: &Path,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>> { ... }
fn convert_path<'a>(
&self,
os_str: Cow<'a, OsStr>,
direction: PathConversion
) -> Cow<'a, OsStr> { ... }
}
Provided Methods§
sourcefn read_os_str_from_c_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, &'a OsStr>where
'tcx: 'a,
'mir: 'a,
fn read_os_str_from_c_str<'a>( &'a self, ptr: Pointer<Option<Provenance>> ) -> InterpResult<'tcx, &'a OsStr>where 'tcx: 'a, 'mir: 'a,
Helper function to read an OsString from a null-terminated sequence of bytes, which is what the Unix APIs usually handle.
sourcefn read_os_str_from_wide_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, OsString>where
'tcx: 'a,
'mir: 'a,
fn read_os_str_from_wide_str<'a>( &'a self, ptr: Pointer<Option<Provenance>> ) -> InterpResult<'tcx, OsString>where 'tcx: 'a, 'mir: 'a,
Helper function to read an OsString from a 0x0000-terminated sequence of u16, which is what the Windows APIs usually handle.
sourcefn write_os_str_to_c_str(
&mut self,
os_str: &OsStr,
ptr: Pointer<Option<Provenance>>,
size: u64
) -> InterpResult<'tcx, (bool, u64)>
fn write_os_str_to_c_str( &mut self, os_str: &OsStr, ptr: Pointer<Option<Provenance>>, 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. This function returns Ok((false, length))
without trying
to write if size
is not large enough to fit the contents of os_string
plus a null
terminator. It returns Ok((true, length))
if the writing process was successful. The
string length returned does include the null terminator.
sourcefn write_os_str_to_wide_str(
&mut self,
os_str: &OsStr,
ptr: Pointer<Option<Provenance>>,
size: u64,
truncate: bool
) -> InterpResult<'tcx, (bool, u64)>
fn write_os_str_to_wide_str( &mut self, os_str: &OsStr, ptr: Pointer<Option<Provenance>>, size: u64, truncate: bool ) -> InterpResult<'tcx, (bool, u64)>
Helper function to write an OsStr as a 0x0000-terminated u16-sequence, which is what the Windows APIs usually handle.
If truncate == false
(the usual mode of operation), this function returns Ok((false, length))
without trying to write if size
is not large enough to fit the contents of
os_string
plus a null terminator. It returns Ok((true, length))
if the writing process
was successful. The string length returned does include the null terminator. Length is
measured in units of u16.
If truncate == true
, then in case size
is not large enough it will write the first
size.saturating_sub(1)
many items, followed by a null terminator (if size > 0
).
sourcefn alloc_os_str_as_c_str(
&mut self,
os_str: &OsStr,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
fn alloc_os_str_as_c_str( &mut self, os_str: &OsStr, memkind: MemoryKind<MiriMemoryKind> ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
Allocate enough memory to store the given OsStr
as a null-terminated sequence of bytes.
sourcefn alloc_os_str_as_wide_str(
&mut self,
os_str: &OsStr,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
fn alloc_os_str_as_wide_str( &mut self, os_str: &OsStr, memkind: MemoryKind<MiriMemoryKind> ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
Allocate enough memory to store the given OsStr
as a null-terminated sequence of u16
.
sourcefn read_path_from_c_str<'a>(
&'a self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, Cow<'a, Path>>where
'tcx: 'a,
'mir: 'a,
fn read_path_from_c_str<'a>( &'a self, ptr: Pointer<Option<Provenance>> ) -> InterpResult<'tcx, Cow<'a, Path>>where 'tcx: 'a, 'mir: 'a,
Read a null-terminated sequence of bytes, and perform path separator conversion if needed.
sourcefn read_path_from_wide_str(
&self,
ptr: Pointer<Option<Provenance>>
) -> InterpResult<'tcx, PathBuf>
fn read_path_from_wide_str( &self, ptr: Pointer<Option<Provenance>> ) -> InterpResult<'tcx, PathBuf>
Read a null-terminated sequence of u16
s, and perform path separator conversion if needed.
sourcefn write_path_to_c_str(
&mut self,
path: &Path,
ptr: Pointer<Option<Provenance>>,
size: u64
) -> InterpResult<'tcx, (bool, u64)>
fn write_path_to_c_str( &mut self, path: &Path, ptr: Pointer<Option<Provenance>>, 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.
sourcefn write_path_to_wide_str(
&mut self,
path: &Path,
ptr: Pointer<Option<Provenance>>,
size: u64,
truncate: bool
) -> InterpResult<'tcx, (bool, u64)>
fn write_path_to_wide_str( &mut self, path: &Path, ptr: Pointer<Option<Provenance>>, size: u64, truncate: bool ) -> InterpResult<'tcx, (bool, u64)>
Write a Path to the machine memory (as a null-terminated sequence of u16
s),
adjusting path separators if needed.
sourcefn alloc_path_as_c_str(
&mut self,
path: &Path,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
fn alloc_path_as_c_str( &mut self, path: &Path, memkind: MemoryKind<MiriMemoryKind> ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
Allocate enough memory to store a Path as a null-terminated sequence of bytes, adjusting path separators if needed.
sourcefn alloc_path_as_wide_str(
&mut self,
path: &Path,
memkind: MemoryKind<MiriMemoryKind>
) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
fn alloc_path_as_wide_str( &mut self, path: &Path, memkind: MemoryKind<MiriMemoryKind> ) -> InterpResult<'tcx, Pointer<Option<Provenance>>>
Allocate enough memory to store a Path as a null-terminated sequence of u16
s,
adjusting path separators if needed.