Struct file_rotate::suffix::AppendCount
source · pub struct AppendCount { /* private fields */ }
Expand description
Append a number when rotating the file. The greater the number, the older. The oldest files are deleted.
Implementations§
source§impl AppendCount
impl AppendCount
sourcepub fn new(max_files: usize) -> Self
pub fn new(max_files: usize) -> Self
New suffix scheme, deleting files when the number of rotated files (i.e. excluding the main
file) exceeds max_files
.
For example, if max_files
is 3, then the files log
, log.1
, log.2
, log.3
may exist
but not log.4
. In other words, max_files
determines the largest possible suffix number.
Trait Implementations§
source§impl SuffixScheme for AppendCount
impl SuffixScheme for AppendCount
§type Repr = usize
type Repr = usize
The representation of suffixes that this suffix scheme uses.
E.g. if the suffix is a number, you can use
usize
.source§fn rotate_file(
&mut self,
_basepath: &Path,
_: Option<&usize>,
suffix: &Option<usize>
) -> Result<usize>
fn rotate_file( &mut self, _basepath: &Path, _: Option<&usize>, suffix: &Option<usize> ) -> Result<usize>
file-rotate
calls this function when the file at suffix
needs to be rotated, and moves the log file
accordingly. Thus, this function should not move any files itself. Read moresource§fn too_old(&self, _suffix: &usize, file_number: usize) -> bool
fn too_old(&self, _suffix: &usize, file_number: usize) -> bool
Whether either the suffix or the chronological file number indicates that the file is old
and should be deleted, depending of course on the file limit.
file_number
starts at 0 for the most recent suffix.source§fn scan_suffixes(&self, basepath: &Path) -> BTreeSet<SuffixInfo<Self::Repr>>
fn scan_suffixes(&self, basepath: &Path) -> BTreeSet<SuffixInfo<Self::Repr>>
Find all files in the basepath.parent() directory that has path equal to basepath + a valid
suffix. Return sorted collection - sorted from most recent to oldest based on the
Ord implementation of
Self::Repr
.Auto Trait Implementations§
impl Freeze for AppendCount
impl RefUnwindSafe for AppendCount
impl Send for AppendCount
impl Sync for AppendCount
impl Unpin for AppendCount
impl UnwindSafe for AppendCount
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