1use std::fmt::Display;
15use std::fmt::Formatter;
16use std::fmt::Result as FmtResult;
17
18#[must_use]
34#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
35pub enum ContractCheckId {
36 AppendBasic,
38 AsyncCopyCancelCommit,
40 AsyncCopyCancelNativeAttempt,
42 AsyncCopyCancelReader,
44 AsyncCopyCancelWriter,
46 CopyAtomicFile,
48 CopyAtomicTree,
50 CopyBasic,
52 CopyDurableFile,
54 CopyDurableTree,
56 CopyFallbackOverwriteRejected,
58 CopyNativeNonEmpty,
60 CopyRepeatedExecute,
62 CopyServerSide,
64 DeleteBasic,
66 DeleteIfMatch,
68 DeleteMissingOk,
70 DeleteTree,
72 DirectoryCreate,
74 DirectoryRecursive,
76 ErrorContext,
78 ListBasic,
80 ListLiteralPrefix,
82 ListNamespace,
84 ListRawRootPrefix,
86 ListPagination,
88 ListPrefix,
90 PropertiesCapabilityDependencies,
92 PropertiesLimitComponentAdmission,
94 PropertiesLimitListPage,
96 PropertiesLimitPathAdmission,
98 PropertiesLimits,
100 PropertiesPathConstraints,
102 PropertiesSnapshot,
104 PropertiesSymlinkPolicy,
106 ReadBasic,
108 ReadChecksum,
110 ReadChecksumCorruption,
112 ReadIfMatchCurrent,
114 ReadIfMatchStale,
116 ReadIfNoneMatchCurrent,
118 ReadIfNoneMatchStale,
120 ReadRange,
122 ReadRangeLimit,
124 RandomAccessBasic,
126 RandomAccessBounds,
128 RandomAccessRangeLimit,
130 RandomAccessIdentity,
132 RandomAccessCancel,
134 RenameAtomic,
136 RenameBasic,
138 RenameConflict,
140 RenameDurable,
142 RepresentationEmpty,
144 RepresentationSymlink,
146 StatBasic,
148 StatFileKind,
150 TempAtomic,
152 TempDirectory,
154 TempFile,
156 TempRepeatedLifecycle,
158 WriteAtomicReplaceExisting,
160 WriteBasic,
162 WriteCreateConflict,
164 WriteReplace,
166 WriteAbort,
168 WriteCancelCommit,
170 WriteCancelFlush,
172 WriteCancelOpen,
174 WriteCancelWrite,
176 WriteDurable,
178 WriteIfAbsent,
180 WriteIfMatch,
182 WriteLimit,
184 WriteOwningOperation,
186 WriteRepeatedExecute,
188}
189
190impl ContractCheckId {
191 pub const ALL: &[Self] = &[
193 Self::AppendBasic,
194 Self::AsyncCopyCancelCommit,
195 Self::AsyncCopyCancelNativeAttempt,
196 Self::AsyncCopyCancelReader,
197 Self::AsyncCopyCancelWriter,
198 Self::CopyAtomicFile,
199 Self::CopyAtomicTree,
200 Self::CopyBasic,
201 Self::CopyDurableFile,
202 Self::CopyDurableTree,
203 Self::CopyFallbackOverwriteRejected,
204 Self::CopyNativeNonEmpty,
205 Self::CopyRepeatedExecute,
206 Self::CopyServerSide,
207 Self::DeleteBasic,
208 Self::DeleteIfMatch,
209 Self::DeleteMissingOk,
210 Self::DeleteTree,
211 Self::DirectoryCreate,
212 Self::DirectoryRecursive,
213 Self::ErrorContext,
214 Self::ListBasic,
215 Self::ListLiteralPrefix,
216 Self::ListNamespace,
217 Self::ListRawRootPrefix,
218 Self::ListPagination,
219 Self::ListPrefix,
220 Self::PropertiesCapabilityDependencies,
221 Self::PropertiesLimitComponentAdmission,
222 Self::PropertiesLimitListPage,
223 Self::PropertiesLimitPathAdmission,
224 Self::PropertiesLimits,
225 Self::PropertiesPathConstraints,
226 Self::PropertiesSnapshot,
227 Self::PropertiesSymlinkPolicy,
228 Self::ReadBasic,
229 Self::ReadChecksum,
230 Self::ReadChecksumCorruption,
231 Self::ReadIfMatchCurrent,
232 Self::ReadIfMatchStale,
233 Self::ReadIfNoneMatchCurrent,
234 Self::ReadIfNoneMatchStale,
235 Self::ReadRange,
236 Self::ReadRangeLimit,
237 Self::RandomAccessBasic,
238 Self::RandomAccessBounds,
239 Self::RandomAccessRangeLimit,
240 Self::RandomAccessIdentity,
241 Self::RandomAccessCancel,
242 Self::RenameAtomic,
243 Self::RenameBasic,
244 Self::RenameConflict,
245 Self::RenameDurable,
246 Self::RepresentationEmpty,
247 Self::RepresentationSymlink,
248 Self::StatBasic,
249 Self::StatFileKind,
250 Self::TempAtomic,
251 Self::TempDirectory,
252 Self::TempFile,
253 Self::TempRepeatedLifecycle,
254 Self::WriteAtomicReplaceExisting,
255 Self::WriteBasic,
256 Self::WriteCreateConflict,
257 Self::WriteReplace,
258 Self::WriteAbort,
259 Self::WriteCancelCommit,
260 Self::WriteCancelFlush,
261 Self::WriteCancelOpen,
262 Self::WriteCancelWrite,
263 Self::WriteDurable,
264 Self::WriteIfAbsent,
265 Self::WriteIfMatch,
266 Self::WriteLimit,
267 Self::WriteOwningOperation,
268 Self::WriteRepeatedExecute,
269 ];
270
271 #[must_use]
277 pub const fn contract(self) -> crate::FileSystemContract {
278 crate::internal::check_catalog::specification(self).contract
279 }
280
281 #[must_use]
290 pub const fn is_optional(self) -> bool {
291 crate::internal::check_catalog::specification(self).optional
292 }
293
294 #[must_use]
300 pub const fn supports_synchronous(self) -> bool {
301 !crate::internal::check_catalog::specification(self).asynchronous_only
302 }
303
304 #[must_use]
310 #[inline]
311 pub const fn as_str(self) -> &'static str {
312 match self {
313 Self::AppendBasic => "append/basic",
314 Self::AsyncCopyCancelCommit => "async-copy/cancel-commit",
315 Self::AsyncCopyCancelNativeAttempt => "async-copy/cancel-native-attempt",
316 Self::AsyncCopyCancelReader => "async-copy/cancel-reader",
317 Self::AsyncCopyCancelWriter => "async-copy/cancel-writer",
318 Self::CopyAtomicFile => "copy/atomic-file",
319 Self::CopyAtomicTree => "copy/atomic-tree",
320 Self::CopyBasic => "copy/basic",
321 Self::CopyDurableFile => "copy/durable-file",
322 Self::CopyDurableTree => "copy/durable-tree",
323 Self::CopyFallbackOverwriteRejected => "copy/fallback-overwrite-rejected",
324 Self::CopyNativeNonEmpty => "copy/native-nonempty",
325 Self::CopyRepeatedExecute => "copy/repeated-execute",
326 Self::CopyServerSide => "copy/server-side",
327 Self::DeleteBasic => "delete/basic",
328 Self::DeleteIfMatch => "delete/if-match",
329 Self::DeleteMissingOk => "delete/missing-ok",
330 Self::DeleteTree => "delete/tree",
331 Self::DirectoryCreate => "directory/create",
332 Self::DirectoryRecursive => "directory/recursive",
333 Self::ErrorContext => "error/context",
334 Self::ListBasic => "list/basic",
335 Self::ListLiteralPrefix => "list/literal-prefix",
336 Self::ListNamespace => "list/namespace",
337 Self::ListRawRootPrefix => "list/raw-root-prefix",
338 Self::ListPagination => "list/pagination",
339 Self::ListPrefix => "list/prefix",
340 Self::PropertiesCapabilityDependencies => "properties/capability-dependencies",
341 Self::PropertiesLimitComponentAdmission => "properties/limit-component-admission",
342 Self::PropertiesLimitListPage => "properties/limit-list-page",
343 Self::PropertiesLimitPathAdmission => "properties/limit-path-admission",
344 Self::PropertiesLimits => "properties/limits",
345 Self::PropertiesPathConstraints => "properties/path-constraints",
346 Self::PropertiesSnapshot => "properties/snapshot",
347 Self::PropertiesSymlinkPolicy => "properties/symlink-policy",
348 Self::ReadBasic => "read/basic",
349 Self::ReadChecksum => "read/checksum",
350 Self::ReadChecksumCorruption => "read/checksum-corruption",
351 Self::ReadIfMatchCurrent => "read/if-match-current",
352 Self::ReadIfMatchStale => "read/if-match-stale",
353 Self::ReadIfNoneMatchCurrent => "read/if-none-match-current",
354 Self::ReadIfNoneMatchStale => "read/if-none-match-stale",
355 Self::ReadRange => "read/range",
356 Self::ReadRangeLimit => "read/range-limit",
357 Self::RandomAccessBasic => "read/random-access-basic",
358 Self::RandomAccessBounds => "read/random-access-bounds",
359 Self::RandomAccessRangeLimit => "read/random-access-range-limit",
360 Self::RandomAccessIdentity => "read/random-access-identity",
361 Self::RandomAccessCancel => "read/random-access-cancel",
362 Self::RenameAtomic => "rename/atomic",
363 Self::RenameBasic => "rename/basic",
364 Self::RenameConflict => "rename/conflict",
365 Self::RenameDurable => "rename/durable",
366 Self::RepresentationEmpty => "representation/empty",
367 Self::RepresentationSymlink => "representation/symlink",
368 Self::StatBasic => "stat/basic",
369 Self::StatFileKind => "stat/file-kind",
370 Self::TempAtomic => "temp/atomic",
371 Self::TempDirectory => "temp/directory",
372 Self::TempFile => "temp/file",
373 Self::TempRepeatedLifecycle => "temp/repeated-lifecycle",
374 Self::WriteAtomicReplaceExisting => "write/atomic-replace-existing",
375 Self::WriteBasic => "write/basic",
376 Self::WriteCreateConflict => "write/create-conflict",
377 Self::WriteReplace => "write/replace",
378 Self::WriteAbort => "write/abort",
379 Self::WriteCancelCommit => "write/cancel-commit",
380 Self::WriteCancelFlush => "write/cancel-flush",
381 Self::WriteCancelOpen => "write/cancel-open",
382 Self::WriteCancelWrite => "write/cancel-write",
383 Self::WriteDurable => "write/durable",
384 Self::WriteIfAbsent => "write/if-absent",
385 Self::WriteIfMatch => "write/if-match",
386 Self::WriteLimit => "write/limit",
387 Self::WriteOwningOperation => "write/owning-operation",
388 Self::WriteRepeatedExecute => "write/repeated-execute",
389 }
390 }
391}
392
393impl Display for ContractCheckId {
394 #[inline]
400 fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult {
401 formatter.write_str(self.as_str())
402 }
403}