qubit_fs/write/write_disposition.rs
1// =============================================================================
2// Copyright (c) 2026 Haixing Hu.
3//
4// SPDX-License-Identifier: Apache-2.0
5//
6// Licensed under the Apache License, Version 2.0.
7// =============================================================================
8//! Destination disposition for write operations.
9
10/// How opening a writer treats an existing destination.
11///
12/// # Examples
13///
14/// ```rust
15/// use qubit_fs::write::WriteDisposition;
16///
17/// assert_eq!(WriteDisposition::CreateOrReplace, WriteDisposition::default());
18/// ```
19#[derive(Clone, Copy, Debug, Eq, PartialEq)]
20pub enum WriteDisposition {
21 /// Create a new destination and fail if one already exists.
22 CreateNew,
23 /// Create a destination or replace its current contents.
24 CreateOrReplace,
25 /// Append bytes to an existing destination.
26 Append,
27}
28
29impl Default for WriteDisposition {
30 #[inline]
31 fn default() -> Self {
32 Self::CreateOrReplace
33 }
34}