Skip to main content

qubit_fs/spi/
resolved_read_options.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// facade.
9//! Facade-resolved read options.
10
11use crate::read::ReadOptions;
12use crate::spi::PrefixReadHint;
13
14/// Immutable reader options resolved by the facade.
15#[derive(Clone)]
16pub struct ResolvedReadOptions {
17    options: ReadOptions,
18    prefix_hint: Option<PrefixReadHint>,
19}
20
21impl ResolvedReadOptions {
22    /// Creates resolved options without a provider optimization hint.
23    #[inline]
24    pub(crate) const fn new(options: ReadOptions) -> Self {
25        Self {
26            options,
27            prefix_hint: None,
28        }
29    }
30
31    /// Adds a non-binding bounded-prefix hint.
32    #[inline]
33    pub(crate) const fn with_prefix_hint(mut self, hint: PrefixReadHint) -> Self {
34        self.prefix_hint = Some(hint);
35        self
36    }
37
38    /// Returns the validated read options.
39    #[inline]
40    #[must_use]
41    pub const fn options(&self) -> &ReadOptions {
42        &self.options
43    }
44
45    /// Returns the optional prefix hint.
46    #[inline]
47    #[must_use]
48    pub const fn prefix_hint(&self) -> Option<PrefixReadHint> {
49        self.prefix_hint
50    }
51}