pub struct FileListenerBuilder { /* private fields */ }Expand description
Builds a FileListener.
Implementations§
Source§impl FileListenerBuilder
 
impl FileListenerBuilder
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Self
 
pub fn new<P: AsRef<Path>>(path: P) -> Self
Creates a new FileListenerBuilder for the specified file path.
Sourcepub const fn max_lines(self, max: usize) -> Self
 
pub const fn max_lines(self, max: usize) -> Self
Sets the maximum number of lines the FileListener will keep in its buffer.
Sourcepub const fn initial_read_lines(self, lines: usize) -> Self
 
pub const fn initial_read_lines(self, lines: usize) -> Self
Sets the number of lines to read from the end of the file on the first tick().
Sourcepub fn parser<F>(self, parser: F) -> Self
 
pub fn parser<F>(self, parser: F) -> Self
Sets a custom line parser.
The parser is a closure that takes the read line (String) and the timestamp
of the previous line (Option<DateTime<Utc>>), and returns a tuple of
(DateTime<Utc>, String). This allows for flexible parsing of custom
timestamp formats or assigning timestamps based on other logic.
If not set, a default parser is used which looks for an RFC 3339 timestamp at the beginning of the line.
Sourcepub fn build(self) -> Result<FileListener>
 
pub fn build(self) -> Result<FileListener>
Constructs the FileListener.
§Errors
Returns an Error if the path exists but is not a regular file, or if
there are permission issues.