pub struct ReadOptions { /* private fields */ }Expand description
Fluent configuration must be retained; discarding a changed copy is diagnosed.
#![deny(unused_must_use)]
use vfsi_core::api::ReadOptions;
let options = ReadOptions::new();
options.with_max_total_bytes(std::num::NonZeroUsize::new(4096).unwrap());Aggregate logical byte budget, defaulting to the client’s policy (16 MiB). Range request lengths must fit even if EOF returns fewer bytes. Complete files share the remaining returned-data budget and fail rather than truncate.
use std::num::NonZeroUsize;
use vfsi_core::api::ReadOptions;
let inherited = ReadOptions::new();
let limited = inherited.with_max_total_bytes(NonZeroUsize::new(4096).unwrap());
assert_eq!(limited.max_total_bytes(), NonZeroUsize::new(4096));
assert_eq!(limited.max_total_bytes_or(8192), 4096);
assert_eq!(inherited.max_total_bytes(), None);
assert_eq!(inherited.max_total_bytes_or(8192), 8192);Overrides require an explicitly validated nonzero value.
use vfsi_core::api::ReadOptions;
ReadOptions::new().with_max_total_bytes(std::num::NonZeroUsize::new(0));Implementations§
Source§impl ReadOptions
impl ReadOptions
Sourcepub const fn new() -> ReadOptions
pub const fn new() -> ReadOptions
Inherit the client’s aggregate read budget.
Sourcepub const fn with_max_total_bytes(self, bytes: NonZero<usize>) -> ReadOptions
pub const fn with_max_total_bytes(self, bytes: NonZero<usize>) -> ReadOptions
Override the aggregate budget for this call. New options inherit client policy. Only nonzero overrides are representable. Stream larger files instead of raising this when bounded memory is required.
Sourcepub const fn max_total_bytes(self) -> Option<NonZero<usize>>
pub const fn max_total_bytes(self) -> Option<NonZero<usize>>
Return the configured override, not the effective client budget.
None inherits the client’s budget; it does not mean unlimited.
Sourcepub fn max_total_bytes_or(self, default: usize) -> usize
pub fn max_total_bytes_or(self, default: usize) -> usize
Resolve an inherited aggregate budget against the client’s default.
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