MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / try_build

Method try_build

atomic-core/src/change/provenance/builder.rs:242–251  ·  view source on GitHub ↗

Try to build the provenance, returning an error if required fields are missing.

(self)

Source from the content-addressed store, hash-verified

240
241 /// Try to build the provenance, returning an error if required fields are missing.
242 pub fn try_build(self) -> Result<Provenance, &'static str> {
243 if self.vendor.is_none() {
244 return Err("Vendor is required");
245 }
246 if self.model.is_none() || self.model.as_ref().map(|m| m.is_empty()).unwrap_or(true) {
247 return Err("Model is required");
248 }
249
250 Ok(self.build())
251 }
252}

Calls 4

is_noneMethod · 0.80
as_refMethod · 0.80
is_emptyMethod · 0.45
buildMethod · 0.45