]> git.lizzy.rs Git - rust.git/blobdiff - src/helpers.rs
Add docs for the new helper functions
[rust.git] / src / helpers.rs
index 63380199beab418776f9f464e0d1e09e492fcdc8..4d84106dbe86f7f75413c7e4d92116e9aba3ed59 100644 (file)
@@ -346,11 +346,15 @@ fn check_no_isolation(&mut self, name: &str) -> InterpResult<'tcx> {
         Ok(())
     }
 
+    /// Helper function to read an OsString from a null-terminated sequence of bytes, which is what
+    /// the Unix APIs usually handle.
     fn read_os_string_from_c_string(&mut self, scalar: Scalar<Tag>) -> InterpResult<'tcx, OsString> {
         let bytes = self.eval_context_mut().memory.read_c_str(scalar)?;
         Ok(bytes_to_os_str(bytes)?.into())
     }
 
+    /// Helper function to write an OsStr as a null-terminated sequence of bytes, which is what
+    /// the Unix APIs usually handle.
     fn write_os_str_to_c_string(&mut self, os_str: &OsStr, ptr: Pointer<Tag>, size: u64) -> InterpResult<'tcx> {
         let bytes = os_str_to_bytes(os_str)?;
         let len = bytes.len();