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

Method try_build

atomic-core/src/change/provenance/builder.rs:241–250  ·  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

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

Calls 4

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