Skip to main content

qubit_fs/options/
write_options.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Write operation options.
11
12use qubit_metadata::Metadata;
13
14use crate::{
15    Checksum,
16    WriteMode,
17};
18
19/// Options controlling a write operation.
20#[derive(Clone, Debug, PartialEq)]
21pub struct WriteOptions {
22    /// Whether missing parent directories should be created.
23    pub create_parent: bool,
24    /// Write creation mode.
25    pub mode: WriteMode,
26    /// Optional content type.
27    pub content_type: Option<String>,
28    /// User-defined metadata to attach to the resource.
29    pub user_metadata: Metadata,
30    /// Optional expected content checksum.
31    pub checksum: Option<Checksum>,
32}
33
34impl Default for WriteOptions {
35    #[inline]
36    fn default() -> Self {
37        Self {
38            create_parent: false,
39            mode: WriteMode::default(),
40            content_type: None,
41            user_metadata: Metadata::new(),
42            checksum: None,
43        }
44    }
45}