pub struct ScopedFile<'f> { /* private fields */ }Expand description
The FILE lent to the closure passed to StringFile::with_file.
The FILE points back at its StringFile, so it must not outlive the with_file call. Safe
code only ever gets a &mut ScopedFile<'f> whose 'f is unique to one with_file call, and
can never get a &mut FILE, so the FILE can be neither moved out nor swapped with the FILE
of another (possibly shorter-lived) StringFile.
Implementations§
Source§impl ScopedFile<'_>
impl ScopedFile<'_>
Sourcepub fn write(&self, bytes: &[u8]) -> c_int
pub fn write(&self, bytes: &[u8]) -> c_int
Writes bytes to the StringFile, like FILE::write.
Sourcepub fn as_mut_ptr(&mut self) -> *mut FILE
pub fn as_mut_ptr(&mut self) -> *mut FILE
Returns a pointer to the FILE, for passing to C++ routines that take a FILE*.
The pointer must not be used after the with_file closure returns.