AdaptiveStorageProvider

Struct AdaptiveStorageProvider 

Source
pub struct AdaptiveStorageProvider<F, V>{ /* private fields */ }
Expand description

Provides adaptive storage selection based on stream characteristics.

Takes two storage providers:

  • F: Fixed-length storage provider, used for:
    • Infinite streams (wrapped in BoundedStorageProvider)
    • Finite streams smaller than or equal to the buffer size
  • V: Variable-length storage provider, used for:
    • Finite streams larger than the buffer size

Implementations§

Source§

impl<F, V> AdaptiveStorageProvider<F, V>

Source

pub fn with_fixed_and_variable( fixed_storage: F, variable_storage: V, buffer_size: NonZeroUsize, ) -> Self

Creates a new AdaptiveStorageProvider with separate providers for fixed and variable-length storage.

§Arguments
  • fixed_storage - Provider for fixed-length storage, used for infinite streams (wrapped in BoundedStorageProvider) and finite streams smaller than or equal to buffer_size
  • variable_storage - Provider for variable-length storage, used for finite streams larger than buffer_size
  • buffer_size - Maximum size for using fixed-length storage
Source§

impl<T> AdaptiveStorageProvider<T, T>
where T: StorageProvider,

Source

pub fn new(provider: T, buffer_size: NonZeroUsize) -> Self
where T: Clone,

Creates a new AdaptiveStorageProvider using the same provider type for both fixed and variable-length storage.

This is a convenience constructor that clones the provider and calls with_fixed_and_variable.

Trait Implementations§

Source§

impl<F, V> Clone for AdaptiveStorageProvider<F, V>

Source§

fn clone(&self) -> AdaptiveStorageProvider<F, V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F, V> Debug for AdaptiveStorageProvider<F, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F, V> StorageProvider for AdaptiveStorageProvider<F, V>

Source§

type Reader = AdaptiveStorageReader<<F as StorageProvider>::Reader, <V as StorageProvider>::Reader>

Source used to read from the underlying storage.
Source§

type Writer = AdaptiveStorageWriter<<F as StorageProvider>::Writer, <V as StorageProvider>::Writer>

Handle that can write to the underlying storage.
Source§

fn into_reader_writer( self, content_length: Option<u64>, ) -> Result<(Self::Reader, Self::Writer)>

Turn the provider into a reader and writer.
Source§

fn max_capacity(&self) -> Option<usize>

Returns the maximum number of bytes this provider can hold at a time.

Auto Trait Implementations§

§

impl<F, V> Freeze for AdaptiveStorageProvider<F, V>
where F: Freeze, V: Freeze,

§

impl<F, V> RefUnwindSafe for AdaptiveStorageProvider<F, V>

§

impl<F, V> Send for AdaptiveStorageProvider<F, V>

§

impl<F, V> Sync for AdaptiveStorageProvider<F, V>
where F: Sync, V: Sync,

§

impl<F, V> Unpin for AdaptiveStorageProvider<F, V>
where F: Unpin, V: Unpin,

§

impl<F, V> UnwindSafe for AdaptiveStorageProvider<F, V>
where F: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,