Skip to content

Commit e7eda67

Browse files
committed
Use builder pattern instead
1 parent 82c29a4 commit e7eda67

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

workflow-types/src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,12 @@ impl Workflow {
5959
&self.shells
6060
}
6161

62-
pub fn new(
63-
name: impl Into<String>,
64-
command: impl Into<String>,
65-
description: Option<String>,
66-
) -> Self {
62+
pub fn new(name: impl Into<String>, command: impl Into<String>) -> Self {
6763
Workflow {
6864
name: name.into(),
6965
command: command.into(),
7066
tags: vec![],
71-
description,
67+
description: None,
7268
arguments: vec![],
7369
source_url: None,
7470
author: None,
@@ -81,6 +77,11 @@ impl Workflow {
8177
self.arguments = arguments;
8278
self
8379
}
80+
81+
pub fn with_description(mut self, description: String) -> Self {
82+
self.description = Some(description.clone());
83+
self
84+
}
8485
}
8586

8687
#[derive(Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash, PartialOrd)]

0 commit comments

Comments
 (0)