pub struct ExportRunner {
pub sheet: SheetOptions,
pub queue_pages: usize,
}Expand description
导出执行器
Fields§
§sheet: SheetOptions§queue_pages: usize解析与写出之间的缓冲页数(越多越吃内存,默认 2)
Implementations§
Source§impl ExportRunner
impl ExportRunner
pub fn new(sheet: SheetOptions) -> Self
pub fn queue_pages(self, pages: usize) -> Self
Sourcepub async fn export_xlsx<T, F, Fut>(
&self,
path: impl AsRef<Path>,
fetch: F,
) -> Result<ExportStats>
pub async fn export_xlsx<T, F, Fut>( &self, path: impl AsRef<Path>, fetch: F, ) -> Result<ExportStats>
游标分批拉取 + 流式写文件(推荐:百万行导出走它)
Sourcepub async fn export_multi_sheet<T, F, Fut>(
&self,
path: impl AsRef<Path>,
sheets: Vec<SheetOptions>,
fetch: F,
) -> Result<ExportStats>
pub async fn export_multi_sheet<T, F, Fut>( &self, path: impl AsRef<Path>, sheets: Vec<SheetOptions>, fetch: F, ) -> Result<ExportStats>
多工作表游标导出:每个 sheet 独立分页拉取,顺序写出
与 ExportRunner::export_xlsx 的差别只有一个:fetch 额外收到
sheet_index,可以给每个 sheet 拉不同筛选条件的数据;
写出仍是常量内存,单表百万行不会因为拆表而进内存。
Sourcepub fn export_sheets<T: ExcelRow>(
&self,
path: impl AsRef<Path>,
sheets: Vec<(SheetOptions, Vec<T>)>,
) -> Result<ExportStats>
pub fn export_sheets<T: ExcelRow>( &self, path: impl AsRef<Path>, sheets: Vec<(SheetOptions, Vec<T>)>, ) -> Result<ExportStats>
小数据量:一次性写多个工作表(每个 sheet 独立列定义/数据)
Trait Implementations§
Source§impl Clone for ExportRunner
impl Clone for ExportRunner
Auto Trait Implementations§
impl !RefUnwindSafe for ExportRunner
impl !UnwindSafe for ExportRunner
impl Freeze for ExportRunner
impl Send for ExportRunner
impl Sync for ExportRunner
impl Unpin for ExportRunner
impl UnsafeUnpin for ExportRunner
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