The criteria as a slice, whatever the shape on disk. Callers use this instead of matching, so the legacy variant stays invisible to them.
(&self)
| 124 | /// The criteria as a slice, whatever the shape on disk. Callers use this |
| 125 | /// instead of matching, so the legacy variant stays invisible to them. |
| 126 | pub fn as_slice(&self) -> &[String] { |
| 127 | match self { |
| 128 | // `from_ref` lets a scalar masquerade as a one-element slice without |
| 129 | // allocating — and, crucially, without rewriting the stored form. |
| 130 | Self::One(one) => std::slice::from_ref(one), |
| 131 | Self::Many(many) => many, |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | /// True when no criteria are referenced. Drives `skip_serializing_if`, so an |
| 136 | /// empty list is omitted exactly as it was under the plain `Vec`. |
no outgoing calls