LogFile

Struct LogFile 

Source
pub struct LogFile(/* private fields */);

Implementations§

Source§

impl LogFile

Source

pub fn open(filename: &str) -> Option<Self>

Examples found in repository?
examples/parse_log.rs (line 6)
5fn main() {
6    let log_file = LogFile::open(&env::args().nth(1).expect("Couldn't not get argument."))
7        .expect("Could not open file");
8
9    let log_info = log_file
10        .info()
11        .expect("Couldn't get information about the log");
12    println!("{:#?}", log_info);
13
14    println!("Buffers:");
15    for (index, buffer_info) in log_file.into_iter().enumerate() {
16        let buffer_info = buffer_info.expect("Couldn't get info about buffer {index}.");
17        println!("{:#?}", buffer_info);
18
19        log_file
20            .parse_static(index as i32, my_callback)
21            .expect("LogFile::parse_static() failed");
22    }
23}
Source

pub fn info(&self) -> Result<LogInfo, i32>

Examples found in repository?
examples/parse_log.rs (line 10)
5fn main() {
6    let log_file = LogFile::open(&env::args().nth(1).expect("Couldn't not get argument."))
7        .expect("Could not open file");
8
9    let log_info = log_file
10        .info()
11        .expect("Couldn't get information about the log");
12    println!("{:#?}", log_info);
13
14    println!("Buffers:");
15    for (index, buffer_info) in log_file.into_iter().enumerate() {
16        let buffer_info = buffer_info.expect("Couldn't get info about buffer {index}.");
17        println!("{:#?}", buffer_info);
18
19        log_file
20            .parse_static(index as i32, my_callback)
21            .expect("LogFile::parse_static() failed");
22    }
23}
Source

pub fn buffer_info(&self, buffer_index: i32) -> Result<BufferInfo, i32>

Source

pub fn parse_static<F>(&self, buffer_index: i32, callback: F) -> Result<(), i32>
where F: FnMut(PacketInfo<'_>) -> Result<(), i32>,

Examples found in repository?
examples/parse_log.rs (line 20)
5fn main() {
6    let log_file = LogFile::open(&env::args().nth(1).expect("Couldn't not get argument."))
7        .expect("Could not open file");
8
9    let log_info = log_file
10        .info()
11        .expect("Couldn't get information about the log");
12    println!("{:#?}", log_info);
13
14    println!("Buffers:");
15    for (index, buffer_info) in log_file.into_iter().enumerate() {
16        let buffer_info = buffer_info.expect("Couldn't get info about buffer {index}.");
17        println!("{:#?}", buffer_info);
18
19        log_file
20            .parse_static(index as i32, my_callback)
21            .expect("LogFile::parse_static() failed");
22    }
23}
Source

pub fn parse_dynamic<F>( &self, buffer_index: i32, callback: F, ) -> Result<(), i32>
where F: FnMut(PacketInfo<'_>) -> Result<(), i32>,

Trait Implementations§

Source§

impl Drop for LogFile

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> IntoIterator for &'a LogFile

Source§

type Item = Option<BufferInfo>

The type of the elements being iterated over.
Source§

type IntoIter = BufferInfoIterator<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.