Remove raw pointer from OpenOptions struct
Otherwise it is not Send and Sync anymore
This commit is contained in:
parent
9c569189c8
commit
ae30294771
2 changed files with 9 additions and 3 deletions
|
@ -2264,6 +2264,12 @@ mod tests {
|
||||||
assert_eq!(check!(fs::metadata(&tmpdir.join("h"))).len(), 9);
|
assert_eq!(check!(fs::metadata(&tmpdir.join("h"))).len(), 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn _assert_send_sync() {
|
||||||
|
fn _assert_send_sync<T: Send + Sync>() {}
|
||||||
|
_assert_send_sync::<OpenOptions>();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn binary_file() {
|
fn binary_file() {
|
||||||
let mut bytes = [0; 1024];
|
let mut bytes = [0; 1024];
|
||||||
|
|
|
@ -69,7 +69,7 @@ pub struct OpenOptions {
|
||||||
attributes: c::DWORD,
|
attributes: c::DWORD,
|
||||||
share_mode: c::DWORD,
|
share_mode: c::DWORD,
|
||||||
security_qos_flags: c::DWORD,
|
security_qos_flags: c::DWORD,
|
||||||
security_attributes: c::LPSECURITY_ATTRIBUTES,
|
security_attributes: usize, // FIXME: should be a reference
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
|
@ -170,7 +170,7 @@ impl OpenOptions {
|
||||||
share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE,
|
share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE,
|
||||||
attributes: 0,
|
attributes: 0,
|
||||||
security_qos_flags: 0,
|
security_qos_flags: 0,
|
||||||
security_attributes: ptr::null_mut(),
|
security_attributes: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ impl OpenOptions {
|
||||||
pub fn attributes(&mut self, attrs: u32) { self.attributes = attrs; }
|
pub fn attributes(&mut self, attrs: u32) { self.attributes = attrs; }
|
||||||
pub fn security_qos_flags(&mut self, flags: u32) { self.security_qos_flags = flags; }
|
pub fn security_qos_flags(&mut self, flags: u32) { self.security_qos_flags = flags; }
|
||||||
pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) {
|
pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) {
|
||||||
self.security_attributes = attrs;
|
self.security_attributes = attrs as usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_access_mode(&self) -> io::Result<c::DWORD> {
|
fn get_access_mode(&self) -> io::Result<c::DWORD> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue