pub struct ChunkStrategy<'a> { /* private fields */ }
Expand description
Configuration for chunking operations.
Contains all necessary parameters for performing chunked file operations.
Implementations§
Source§impl<'a> ChunkStrategy<'a>
Implementation of chunk strategy methods.
impl<'a> ChunkStrategy<'a>
Implementation of chunk strategy methods.
Sourcepub fn new<F>(
start_chunk_index: usize,
upload_dir: &'a str,
file_id: &'a str,
file_name: &'a str,
total_chunks: usize,
file_name_func: F,
) -> Result<ChunkStrategy<'a>, ChunkStrategyError>where
F: ChunkNaming<'a> + 'static,
pub fn new<F>(
start_chunk_index: usize,
upload_dir: &'a str,
file_id: &'a str,
file_name: &'a str,
total_chunks: usize,
file_name_func: F,
) -> Result<ChunkStrategy<'a>, ChunkStrategyError>where
F: ChunkNaming<'a> + 'static,
Creates a new chunk strategy instance.
§Arguments
usize
- Starting chunk index (0-based)&str
- Directory path for chunk storage&str
- Unique file identifier&str
- Original filenameusize
- Total chunks countF
- Function implementing ChunkNaming trait
§Returns
NewChunkStrategyResult
- Result containing strategy or error
Trait Implementations§
Source§impl<'a> HandleStrategy<'a> for ChunkStrategy<'a>
Implementation of handle strategy for chunk operations.
impl<'a> HandleStrategy<'a> for ChunkStrategy<'a>
Implementation of handle strategy for chunk operations.
Source§async fn save_chunk(
&self,
chunk_data: &'a [u8],
chunk_index: usize,
) -> Result<(), ChunkStrategyError>
async fn save_chunk( &self, chunk_data: &'a [u8], chunk_index: usize, ) -> Result<(), ChunkStrategyError>
Source§async fn merge_chunks(&self) -> Result<(), ChunkStrategyError>
async fn merge_chunks(&self) -> Result<(), ChunkStrategyError>
Auto Trait Implementations§
impl<'a> Freeze for ChunkStrategy<'a>
impl<'a> !RefUnwindSafe for ChunkStrategy<'a>
impl<'a> Send for ChunkStrategy<'a>
impl<'a> Sync for ChunkStrategy<'a>
impl<'a> Unpin for ChunkStrategy<'a>
impl<'a> !UnwindSafe for ChunkStrategy<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more