qubit-fs 0.2.2

Provider-neutral synchronous and asynchronous filesystem abstraction for Rust
Documentation
// =============================================================================
//    Copyright (c) 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================
// facade.
//! Validated directory-listing request.

use crate::directory::ListScope;
use crate::spi::ResolvedListOptions;

/// Validated listing scope and immutable provider-facing options.
///
/// # Examples
///
/// ```rust
/// use qubit_fs::directory::ListOptions;
/// use qubit_fs::path::Path;
/// use qubit_fs::spi::ListRequest;
///
/// let path = Path::parse("/dir")?;
/// assert!(std::any::type_name::<ListRequest<'_>>().contains("ListRequest"));
/// assert_eq!("/dir", path.as_str());
/// let _ = ListOptions::default();
/// # Ok::<(), qubit_fs::FsError>(())
/// ```
pub struct ListRequest<'a> {
    /// Caller-selected prefix or configured namespace.
    scope: &'a ListScope,
    /// Facade-resolved enumeration behavior.
    options: ResolvedListOptions,
}

impl<'a> ListRequest<'a> {
    /// Creates a request after facade preflight.
    pub(crate) const fn new(scope: &'a ListScope, options: ResolvedListOptions) -> Self {
        Self { scope, options }
    }

    /// Returns the exact caller scope without synthesizing an empty path.
    #[inline]
    #[must_use]
    pub const fn scope(&self) -> &'a ListScope {
        self.scope
    }

    /// Returns immutable resolved listing options.
    #[inline]
    #[must_use]
    pub const fn options(&self) -> &ResolvedListOptions {
        &self.options
    }
}