aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-08-17 14:52:11 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-08-17 14:52:11 +0200
commit0585e43fa82a359e768815394b493801773feb0c (patch)
treea7b638e4040079668305264120efc82a58b4bce1 /src/lib.rs
parentcb4ade7710f6fa171130edeeabfa2db2fb1c526b (diff)
downloadevtclib-0585e43fa82a359e768815394b493801773feb0c.tar.gz
evtclib-0585e43fa82a359e768815394b493801773feb0c.tar.bz2
evtclib-0585e43fa82a359e768815394b493801773feb0c.zip
add Log::errors convenience method
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index b3c587d..cd483da 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -897,4 +897,20 @@ impl Log {
}
})
}
+
+ /// Returns all error strings that were captured.
+ ///
+ /// If no errors were encountered, an empty vec is returned.
+ ///
+ /// Note that those are errors reported verbatim by arcdps, nothing that evtclib
+ /// produces/interprets.
+ pub fn errors(&self) -> Vec<&str> {
+ self.events().iter().filter_map(|e| {
+ if let EventKind::Error { ref text } = e.kind() {
+ Some(text as &str)
+ } else {
+ None
+ }
+ }).collect()
+ }
}