Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Derive Default, Clone for builders #259

Merged
merged 1 commit into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gir
9 changes: 2 additions & 7 deletions src/auto/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl Application {
}
}

#[derive(Clone, Default)]
pub struct ApplicationBuilder {
action_group: Option<ActionGroup>,
application_id: Option<String>,
Expand All @@ -70,13 +71,7 @@ pub struct ApplicationBuilder {

impl ApplicationBuilder {
pub fn new() -> Self {
Self {
action_group: None,
application_id: None,
flags: None,
inactivity_timeout: None,
resource_base_path: None,
}
Self::default()
}

pub fn build(self) -> Application {
Expand Down
7 changes: 2 additions & 5 deletions src/auto/buffered_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl BufferedInputStream {
}
}

#[derive(Clone, Default)]
pub struct BufferedInputStreamBuilder {
buffer_size: Option<u32>,
base_stream: Option<InputStream>,
Expand All @@ -61,11 +62,7 @@ pub struct BufferedInputStreamBuilder {

impl BufferedInputStreamBuilder {
pub fn new() -> Self {
Self {
buffer_size: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> BufferedInputStream {
Expand Down
8 changes: 2 additions & 6 deletions src/auto/buffered_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl BufferedOutputStream {
}
}

#[derive(Clone, Default)]
pub struct BufferedOutputStreamBuilder {
auto_grow: Option<bool>,
buffer_size: Option<u32>,
Expand All @@ -56,12 +57,7 @@ pub struct BufferedOutputStreamBuilder {

impl BufferedOutputStreamBuilder {
pub fn new() -> Self {
Self {
auto_grow: None,
buffer_size: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> BufferedOutputStream {
Expand Down
7 changes: 2 additions & 5 deletions src/auto/charset_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl CharsetConverter {
}
}

#[derive(Clone, Default)]
pub struct CharsetConverterBuilder {
from_charset: Option<String>,
to_charset: Option<String>,
Expand All @@ -55,11 +56,7 @@ pub struct CharsetConverterBuilder {

impl CharsetConverterBuilder {
pub fn new() -> Self {
Self {
from_charset: None,
to_charset: None,
use_fallback: None,
}
Self::default()
}

pub fn build(self) -> CharsetConverter {
Expand Down
7 changes: 2 additions & 5 deletions src/auto/converter_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl ConverterInputStream {
}
}

#[derive(Clone, Default)]
pub struct ConverterInputStreamBuilder {
converter: Option<Converter>,
base_stream: Option<InputStream>,
Expand All @@ -45,11 +46,7 @@ pub struct ConverterInputStreamBuilder {

impl ConverterInputStreamBuilder {
pub fn new() -> Self {
Self {
converter: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> ConverterInputStream {
Expand Down
7 changes: 2 additions & 5 deletions src/auto/converter_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl ConverterOutputStream {
}
}

#[derive(Clone, Default)]
pub struct ConverterOutputStreamBuilder {
converter: Option<Converter>,
base_stream: Option<OutputStream>,
Expand All @@ -45,11 +46,7 @@ pub struct ConverterOutputStreamBuilder {

impl ConverterOutputStreamBuilder {
pub fn new() -> Self {
Self {
converter: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> ConverterOutputStream {
Expand Down
9 changes: 2 additions & 7 deletions src/auto/data_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl DataInputStream {
}
}

#[derive(Clone, Default)]
pub struct DataInputStreamBuilder {
byte_order: Option<DataStreamByteOrder>,
newline_type: Option<DataStreamNewlineType>,
Expand All @@ -56,13 +57,7 @@ pub struct DataInputStreamBuilder {

impl DataInputStreamBuilder {
pub fn new() -> Self {
Self {
byte_order: None,
newline_type: None,
buffer_size: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> DataInputStream {
Expand Down
7 changes: 2 additions & 5 deletions src/auto/data_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl DataOutputStream {
}
}

#[derive(Clone, Default)]
pub struct DataOutputStreamBuilder {
byte_order: Option<DataStreamByteOrder>,
base_stream: Option<OutputStream>,
Expand All @@ -48,11 +49,7 @@ pub struct DataOutputStreamBuilder {

impl DataOutputStreamBuilder {
pub fn new() -> Self {
Self {
byte_order: None,
base_stream: None,
close_base_stream: None,
}
Self::default()
}

pub fn build(self) -> DataOutputStream {
Expand Down
6 changes: 2 additions & 4 deletions src/auto/list_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,15 @@ impl ListStore {
}
}

#[derive(Clone, Default)]
pub struct ListStoreBuilder {
#[cfg(any(feature = "v2_44", feature = "dox"))]
item_type: Option<glib::types::Type>,
}

impl ListStoreBuilder {
pub fn new() -> Self {
Self {
#[cfg(any(feature = "v2_44", feature = "dox"))]
item_type: None,
}
Self::default()
}

pub fn build(self) -> ListStore {
Expand Down
2 changes: 1 addition & 1 deletion src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 8335272)
Generated by gir (https://github.com/gtk-rs/gir @ 7589cc6)
from gir-files (https://github.com/gtk-rs/gir-files @ 22748fa)