Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

Commit 38db22c

Browse files
authored
Generate value as bool (#209)
* Generate value as bool This will generate publish=false as an actual toml bool, instead of a string value * Update changelog
1 parent 7cd4fc6 commit 38db22c

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99
## unreleased
1010

1111
- Add ability to add `publish` to the generated Cargo.toml file (#208)
12+
- Fix generating publish value as a toml bool (#209)
1213

1314
## [3.0.0] - 2023-04-28
1415

fp-bindgen/src/generators/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub enum RustPluginConfigValue {
9797
String(String),
9898
Vec(Vec<String>),
9999
Workspace,
100+
Bool(bool),
100101
}
101102

102103
impl From<&str> for RustPluginConfigValue {
@@ -123,6 +124,12 @@ impl From<Vec<String>> for RustPluginConfigValue {
123124
}
124125
}
125126

127+
impl From<bool> for RustPluginConfigValue {
128+
fn from(value: bool) -> Self {
129+
Self::Bool(value)
130+
}
131+
}
132+
126133
pub struct RustPluginConfigBuilder {
127134
config: RustPluginConfig,
128135
}
@@ -184,7 +191,7 @@ impl RustPluginConfigBuilder {
184191
}
185192

186193
pub fn publish(mut self, value: bool) -> Self {
187-
self.config.publish = Some(RustPluginConfigValue::String(value.to_string()));
194+
self.config.publish = Some(value.into());
188195
self
189196
}
190197

fp-bindgen/src/generators/rust_plugin/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ fn format_cargo_key(key: &str, value: Option<RustPluginConfigValue>) -> String {
592592
inline.insert("workspace", true.into());
593593
toml_edit::value(inline)
594594
}
595+
RustPluginConfigValue::Bool(value) => toml_edit::value(value),
595596
};
596597

597598
let mut doc = toml_edit::Document::new();

0 commit comments

Comments
 (0)