#[non_exhaustive]pub struct ReadOptions { /* private fields */ }Expand description
Options controlling a read operation.
§Examples
use qubit_fs::read::ReadOptions;
let options = ReadOptions::default().with_length(Some(1_024));
assert_eq!(Some(1_024), options.length());
assert!(options.validate().is_ok());Implementations§
Source§impl ReadOptions
impl ReadOptions
Sourcepub const fn with_offset(self, offset: Option<u64>) -> Self
pub const fn with_offset(self, offset: Option<u64>) -> Self
Returns a copy with the byte offset replaced.
Sourcepub const fn with_length(self, length: Option<u64>) -> Self
pub const fn with_length(self, length: Option<u64>) -> Self
Returns a copy with the byte length replaced.
Sourcepub fn with_if_match(self, if_match: Option<ResourceVersion>) -> Self
pub fn with_if_match(self, if_match: Option<ResourceVersion>) -> Self
Returns a copy with the positive version precondition replaced.
Sourcepub const fn if_match(&self) -> Option<&ResourceVersion>
pub const fn if_match(&self) -> Option<&ResourceVersion>
Returns the optional positive version precondition.
Sourcepub fn with_if_none_match(self, if_none_match: Option<ResourceVersion>) -> Self
pub fn with_if_none_match(self, if_none_match: Option<ResourceVersion>) -> Self
Returns a copy with the negative version precondition replaced.
Sourcepub const fn if_none_match(&self) -> Option<&ResourceVersion>
pub const fn if_none_match(&self) -> Option<&ResourceVersion>
Returns the optional negative version precondition.
Sourcepub const fn with_checksum(self, checksum: ChecksumPolicy) -> Self
pub const fn with_checksum(self, checksum: ChecksumPolicy) -> Self
Returns a copy with the checksum policy replaced.
Sourcepub const fn checksum(&self) -> ChecksumPolicy
pub const fn checksum(&self) -> ChecksumPolicy
Returns the checksum policy.
Sourcepub fn validate(&self) -> Result<(), FsError>
pub fn validate(&self) -> Result<(), FsError>
Validates provider-independent read options without performing I/O.
A zero-length window is valid, including at the largest offset. Resource existence and access permissions are still checked when opening it. Offsets at or beyond EOF produce an empty window; lengths extending past EOF are truncated. These windows do not imply a resource snapshot.
§Errors
Returns InvalidOptions for mutually exclusive conditions or an
explicit range whose exclusive end cannot be represented as u64.
Sourcepub fn validate_against(
&self,
capabilities: FileSystemCapabilities,
) -> Result<(), FsError>
pub fn validate_against( &self, capabilities: FileSystemCapabilities, ) -> Result<(), FsError>
Validates required read semantics against configured capabilities.
Providers should call this method before opening a reader or producing any observable side effect.
§Errors
Returns FsErrorKind::InvalidOptions for mutually exclusive version
conditions, or FsErrorKind::RequirementNotMet with the exact
missing capability for range, conditional, or required-checksum reads.
Trait Implementations§
Source§impl Clone for ReadOptions
impl Clone for ReadOptions
Source§fn clone(&self) -> ReadOptions
fn clone(&self) -> ReadOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more