#[derive(Debug)]
pub struct OpenOptions {
read: bool,
write: bool,
append: bool,
truncate: bool,
create: bool,
create_new: bool,
}
impl OpenOptions {
#[allow(clippy::new_without_default)]
#[inline]
pub fn new() -> Self {
Self {
read: false,
write: false,
append: false,
truncate: false,
create: false,
create_new: false,
}
}
#[inline]
pub fn read(&mut self, read: bool) -> &mut Self {
self.read = read;
self
}
#[inline]
pub fn write(&mut self, write: bool) -> &mut Self {
self.write = write;
self
}
#[inline]
pub fn append(&mut self, append: bool) -> &mut Self {
self.append = append;
self
}
#[inline]
pub fn truncate(&mut self, truncate: bool) -> &mut Self {
self.truncate = truncate;
self
}
#[inline]
pub fn create(&mut self, create: bool) -> &mut Self {
self.create = create;
self
}
#[inline]
pub fn create_new(&mut self, create_new: bool) -> &mut Self {
self.create_new = create_new;
self
}
}