pub struct DownloadPathLock { /* private fields */ }Expand description
Manages file locks for all files in a download directory.
Creates a .aria2.lock file in the output directory to indicate that an
aria2 download is active. This prevents multiple aria2 instances from
writing to the same output location simultaneously.
The lock is held for the lifetime of the DownloadPathLock struct and
is automatically released when it is dropped.
Implementations§
Source§impl DownloadPathLock
impl DownloadPathLock
Sourcepub fn acquire_for_download(output_dir: &Path) -> Result<Self, String>
pub fn acquire_for_download(output_dir: &Path) -> Result<Self, String>
Acquire a download lock for the given output directory.
Creates (or locks) a .aria2.lock file inside output_dir. If another
aria2 instance already holds a lock on this directory, returns an error.
§Arguments
output_dir- The directory where downloaded files will be written.
§Errors
Returns Err if:
- The directory does not exist and cannot be created.
- Another process holds the lock on
.aria2.lockin this directory.
Auto Trait Implementations§
impl Freeze for DownloadPathLock
impl RefUnwindSafe for DownloadPathLock
impl Send for DownloadPathLock
impl Sync for DownloadPathLock
impl Unpin for DownloadPathLock
impl UnsafeUnpin for DownloadPathLock
impl UnwindSafe for DownloadPathLock
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