Skip to main content

Log

Struct Log 

Source
pub struct Log {
    header: Vec<String>,
    entries: Vec<Entry>,
    clock: fn() -> i64,
    path: Option<PathBuf>,
    file: Option<File>,
}

Fields§

§header: Vec<String>§entries: Vec<Entry>§clock: fn() -> i64§path: Option<PathBuf>§file: Option<File>

Implementations§

Source§

impl Log

Source

pub fn create(header: Vec<String>, path: Option<PathBuf>) -> Log

header heads the file and not the pane: it is what support asks for first, which a user reading along does not need. A file that cannot be opened leaves a log without one.

Source

pub fn with_clock( header: Vec<String>, path: Option<PathBuf>, clock: fn() -> i64, ) -> Log

create, telling the time by clock, so a test can name the moment.

Source

pub fn attach(&mut self, path: PathBuf)

Points the log at a file, writing out the header and everything said so far, since the game folder it belongs in is only known partway through the run; a second call follows the run to another folder.

Source

pub fn line(&mut self, text: impl Into<String>)

Flushed at once, so a run that dies still leaves the line saying what it was doing.

Source

pub fn lines(&self) -> impl Iterator<Item = &str>

As the pane shows them: without the times, which only the file needs.

Source

pub fn text(&self) -> String

CRLF-separated, because a Win32 multiline edit ignores a lone LF.

Source

pub fn path(&self) -> Option<&Path>

None when no file was written, so the summary never points at one that does not exist.

Source

pub fn is_empty(&self) -> bool

Auto Trait Implementations§

§

impl Freeze for Log

§

impl RefUnwindSafe for Log

§

impl Send for Log

§

impl Sync for Log

§

impl Unpin for Log

§

impl UnsafeUnpin for Log

§

impl UnwindSafe for Log

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.