Remove raw pointer from OpenOptions struct
Otherwise it is not Send and Sync anymore
This commit is contained in:
parent
9c569189c8
commit
ae30294771
@ -2264,6 +2264,12 @@ fn c<T: Clone>(t: &T) -> T { t.clone() }
|
||||
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]
|
||||
fn binary_file() {
|
||||
let mut bytes = [0; 1024];
|
||||
|
@ -69,7 +69,7 @@ pub struct OpenOptions {
|
||||
attributes: c::DWORD,
|
||||
share_mode: 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)]
|
||||
@ -170,7 +170,7 @@ pub fn new() -> OpenOptions {
|
||||
share_mode: c::FILE_SHARE_READ | c::FILE_SHARE_WRITE | c::FILE_SHARE_DELETE,
|
||||
attributes: 0,
|
||||
security_qos_flags: 0,
|
||||
security_attributes: ptr::null_mut(),
|
||||
security_attributes: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ pub fn new() -> OpenOptions {
|
||||
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_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> {
|
||||
|
Loading…
Reference in New Issue
Block a user