Skip to content

Commit cb45c39

Browse files
committed
guard impls
1 parent fe810b1 commit cb45c39

File tree

1 file changed

+63
-53
lines changed

1 file changed

+63
-53
lines changed

sdks/rust/golem-rust/src/agentic/agent_config.rs

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,31 @@ macro_rules! impl_component_model_config_leaf {
143143
}
144144

145145
impl_component_model_config_leaf![
146-
bigdecimal::BigDecimal,
147-
bit_vec::BitVec,
148146
bool,
149-
bytes::Bytes,
150147
char,
151-
chrono::DateTime<chrono::FixedOffset>,
152-
chrono::DateTime<chrono::Local>,
153-
chrono::DateTime<chrono::Utc>,
154-
chrono::FixedOffset,
155-
chrono::Month,
156-
chrono::NaiveDate,
157-
chrono::NaiveDateTime,
158-
chrono::NaiveTime,
159-
chrono::Weekday,
148+
f32,
149+
f64,
150+
i8,
151+
i16,
152+
i32,
153+
i64,
154+
u8,
155+
u16,
156+
u32,
157+
u64,
158+
usize,
159+
String,
160+
Duration,
161+
IpAddr,
162+
NonZeroI8,
163+
NonZeroI16,
164+
NonZeroI32,
165+
NonZeroI64,
166+
NonZeroU8,
167+
NonZeroU16,
168+
NonZeroU32,
169+
NonZeroU64,
170+
uuid::Uuid,
160171
crate::bindings::golem::api::host::AgentAllFilter,
161172
crate::bindings::golem::api::host::AgentAnyFilter,
162173
crate::bindings::golem::api::host::AgentConfigVarsFilter,
@@ -173,47 +184,48 @@ impl_component_model_config_leaf![
173184
crate::bindings::golem::api::host::StringFilterComparator,
174185
crate::bindings::golem::api::host::UpdateMode,
175186
crate::bindings::wasi::logging::logging::Level,
176-
Duration,
177-
f32,
178-
f64,
179-
golem_wasm::AccountId,
180-
golem_wasm::AgentId,
181-
golem_wasm::ComponentId,
182-
golem_wasm::ResourceMode,
183-
golem_wasm::Uri,
184-
golem_wasm::Uuid,
185-
golem_wasm::WitNode,
186-
golem_wasm::WitType,
187-
golem_wasm::WitTypeNode,
188-
golem_wasm::WitValue,
189-
http::uri::Uri,
190-
i16,
191-
i32,
192-
i64,
193-
i8,
194-
IpAddr,
195-
mac_address::MacAddress,
196-
NonZeroI16,
197-
NonZeroI32,
198-
NonZeroI64,
199-
NonZeroI8,
200-
NonZeroU16,
201-
NonZeroU32,
202-
NonZeroU64,
203-
NonZeroU8,
204-
num_bigint::BigInt,
205-
rust_decimal::Decimal,
206-
serde_json::Value,
207-
String,
208-
u16,
209-
u32,
210-
u64,
211-
u8,
212-
url::Url,
213-
usize,
214-
uuid::Uuid,
215187
];
216188

189+
#[cfg(feature = "bigdecimal")]
190+
impl_component_model_config_leaf![bigdecimal::BigDecimal,];
191+
192+
#[cfg(feature = "bit_vec")]
193+
impl_component_model_config_leaf![bit_vec::BitVec,];
194+
195+
#[cfg(feature = "bytes")]
196+
impl_component_model_config_leaf![bytes::Bytes,];
197+
198+
#[cfg(feature = "chrono")]
199+
impl_component_model_config_leaf![
200+
chrono::DateTime<chrono::FixedOffset>,
201+
chrono::DateTime<chrono::Local>,
202+
chrono::DateTime<chrono::Utc>,
203+
chrono::FixedOffset,
204+
chrono::Month,
205+
chrono::NaiveDate,
206+
chrono::NaiveDateTime,
207+
chrono::NaiveTime,
208+
chrono::Weekday,
209+
];
210+
211+
#[cfg(feature = "mac_address")]
212+
impl_component_model_config_leaf![mac_address::MacAddress,];
213+
214+
#[cfg(feature = "num_bigint")]
215+
impl_component_model_config_leaf![num_bigint::BigInt,];
216+
217+
#[cfg(feature = "rust_decimal")]
218+
impl_component_model_config_leaf![rust_decimal::Decimal,];
219+
220+
#[cfg(feature = "serde_json_types")]
221+
impl_component_model_config_leaf![serde_json::Value,];
222+
223+
#[cfg(feature = "url")]
224+
impl_component_model_config_leaf![url::Url,];
225+
226+
#[cfg(feature = "nonempty_collections")]
227+
impl<T: FromValueAndType + IntoValue> ComponentModelConfigLeaf for nonempty_collections::NEVec<T> {}
228+
217229
macro_rules! impl_component_model_config_leaf_for_tuple {
218230
($($T:ident),+) => {
219231
impl<$($T: IntoValue + FromValueAndType),+> ComponentModelConfigLeaf for ($($T),+) {}
@@ -260,5 +272,3 @@ impl<K: FromValueAndType + IntoValue + Ord, V: FromValueAndType + IntoValue>
260272
ComponentModelConfigLeaf for BTreeMap<K, V>
261273
{
262274
}
263-
264-
impl<T: FromValueAndType + IntoValue> ComponentModelConfigLeaf for nonempty_collections::NEVec<T> {}

0 commit comments

Comments
 (0)