1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// =============================================================================
// Copyright (c) 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Provider-prepared asynchronous copy fixture cases.
use qubit_fs::copy::CopyOptions;
use qubit_fs::path::Path;
/// Provider-prepared asynchronous copy request used for cancellation probing.
///
/// # Examples
///
/// ```
/// use qubit_fs::copy::CopyOptions;
/// use qubit_fs::path::Path;
/// use qubit_fs_testkit::AsyncCopyFixtureCase;
///
/// let source = Path::parse("/source")?;
/// let target = Path::parse("/target")?;
/// let case = AsyncCopyFixtureCase::new(source, target, CopyOptions::file());
/// assert_eq!(case.target(), &Path::parse("/target")?);
/// # Ok::<(), qubit_fs::error::FsError>(())
/// ```
#[must_use]
#[derive(Clone, Debug)]
pub struct AsyncCopyFixtureCase {
/// Source path passed to the copy operation.
source: Path,
/// Destination path passed to the copy operation.
target: Path,
/// Options governing the probed copy operation.
options: CopyOptions,
}
impl AsyncCopyFixtureCase {
/// Creates a cancellation probe request from owned copy arguments.
///
/// # Parameters
///
/// * `source` - Source path passed to the copy operation.
/// * `target` - Destination path passed to the copy operation.
/// * `options` - Options governing the copy operation.
///
/// # Returns
///
/// A prepared request containing the supplied arguments.
#[inline]
pub fn new(source: Path, target: Path, options: CopyOptions) -> Self {
Self {
source,
target,
options,
}
}
/// Returns the source path without transferring ownership.
///
/// # Returns
///
/// The prepared source path.
#[inline]
#[must_use]
pub const fn source(&self) -> &Path {
&self.source
}
/// Returns the target path without transferring ownership.
///
/// # Returns
///
/// The prepared destination path.
#[inline]
#[must_use]
pub const fn target(&self) -> &Path {
&self.target
}
/// Returns the copy options without transferring ownership.
///
/// # Returns
///
/// The prepared copy options.
#[inline]
#[must_use]
pub const fn options(&self) -> &CopyOptions {
&self.options
}
/// Decomposes the prepared request into owned parts.
///
/// # Returns
///
/// The source path, destination path, and copy options in that order.
#[inline]
#[must_use]
pub fn into_parts(self) -> (Path, Path, CopyOptions) {
(self.source, self.target, self.options)
}
}