MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / check

Function check

nodedb-array/src/schema/validation/dims.rs:17–37  ·  view source on GitHub ↗
(array: &str, dims: &[DimSpec])

Source from the content-addressed store, hash-verified

15use crate::types::domain::DomainBound;
16
17pub fn check(array: &str, dims: &[DimSpec]) -> ArrayResult<()> {
18 if dims.is_empty() {
19 return Err(ArrayError::InvalidSchema {
20 array: array.to_string(),
21 detail: "at least one dimension is required".to_string(),
22 });
23 }
24 let mut seen = HashSet::with_capacity(dims.len());
25 for d in dims {
26 if !seen.insert(d.name.as_str()) {
27 return Err(ArrayError::InvalidDim {
28 array: array.to_string(),
29 dim: d.name.clone(),
30 detail: "duplicate dimension name".to_string(),
31 });
32 }
33 check_bounds_match_type(array, d)?;
34 check_bound_order(array, d)?;
35 }
36 Ok(())
37}
38
39fn check_bounds_match_type(array: &str, d: &DimSpec) -> ArrayResult<()> {
40 let ok = matches!(

Callers 3

bool_id_checkFunction · 0.50
buildMethod · 0.50

Calls 8

check_bounds_match_typeFunction · 0.85
check_bound_orderFunction · 0.85
to_stringMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45
as_strMethod · 0.45
cloneMethod · 0.45