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

Method to_query_value

atomic-remote/src/streaming/layers.rs:160–178  ·  view source on GitHub ↗

Serialize to a query parameter value. Returns `"all"` if all three layers are selected, otherwise returns a comma-separated list of layer names in canonical order. # Examples ```rust use atomic_remote::streaming::LayerSelection; assert_eq!(LayerSelection::all().to_query_value(), "all"); assert_eq!(LayerSelection::thin_pull().to_query_value(), "graph,content"); assert_eq!(LayerSelection::thin_r

(&self)

Source from the content-addressed store, hash-verified

158 /// assert_eq!(LayerSelection::graph_only().to_query_value(), "graph");
159 /// ```
160 pub fn to_query_value(&self) -> String {
161 if self.is_all() {
162 return "all".to_string();
163 }
164
165 // Canonical order: graph, semantic, content
166 let mut parts = Vec::new();
167 if self.layers.contains(&Layer::Graph) {
168 parts.push("graph");
169 }
170 if self.layers.contains(&Layer::Semantic) {
171 parts.push("semantic");
172 }
173 if self.layers.contains(&Layer::Content) {
174 parts.push("content");
175 }
176
177 parts.join(",")
178 }
179
180 /// Returns `true` if the given layer is included in this selection.
181 #[inline]

Callers 2

Calls 3

is_allMethod · 0.80
containsMethod · 0.45
pushMethod · 0.45

Tested by 1