pub struct RenameHook { /* private fields */ }Expand description
文件重命名钩子
使用模板模式对下载的文件进行重命名。 支持以下占位符:
%d: 源文件所在目录%f: 原始文件名%e: 文件扩展名%i: 下载任务 GID%t: 当前时间戳(Unix 时间戳)
Implementations§
Source§impl RenameHook
impl RenameHook
Sourcepub fn expand_pattern(&self, context: &HookContext) -> String
pub fn expand_pattern(&self, context: &HookContext) -> String
Trait Implementations§
Source§impl Clone for RenameHook
impl Clone for RenameHook
Source§fn clone(&self) -> RenameHook
fn clone(&self) -> RenameHook
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RenameHook
impl Debug for RenameHook
Source§impl PostDownloadHook for RenameHook
impl PostDownloadHook for RenameHook
Source§fn on_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HookContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
context: &'life1 HookContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
执行文件重命名操作
根据模板模式生成新文件名并重命名文件。
Auto Trait Implementations§
impl Freeze for RenameHook
impl RefUnwindSafe for RenameHook
impl Send for RenameHook
impl Sync for RenameHook
impl Unpin for RenameHook
impl UnsafeUnpin for RenameHook
impl UnwindSafe for RenameHook
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