pub struct StatsVisitor {
pub article_count: u64,
pub category_count: u64,
pub link_count: u64,
pub infobox_count: u64,
pub reference_count: u64,
}Expand description
A visitor that collects counts only (low memory footprint).
Tracks aggregate statistics without storing individual articles. Useful for getting overview statistics of a snapshot.
§Example
use wme_stream::{ArticleVisitor, StatsVisitor};
use serde_json::Value;
let mut visitor = StatsVisitor::new();
// Simulate visiting articles
for i in 0..100 {
visitor.visit_article_start(i as u64, "Article");
visitor.visit_category("Category:Test", "https://en.wikipedia.org/wiki/Category:Test");
visitor.visit_link("Link", "https://en.wikipedia.org/wiki/Link");
visitor.visit_article_end();
}
assert_eq!(visitor.article_count, 100);
assert_eq!(visitor.category_count, 100);
assert_eq!(visitor.link_count, 100);Fields§
§article_count: u64Total articles processed
category_count: u64Total categories found
link_count: u64Total links found
infobox_count: u64Total infoboxes found
reference_count: u64Total references found
Implementations§
Trait Implementations§
Source§impl ArticleVisitor for StatsVisitor
impl ArticleVisitor for StatsVisitor
Source§fn visit_article_start(&mut self, _id: u64, _name: &str)
fn visit_article_start(&mut self, _id: u64, _name: &str)
Called when starting to process an article. Read more
Source§fn visit_category(&mut self, _name: &str, _url: &str)
fn visit_category(&mut self, _name: &str, _url: &str)
Called when encountering a category. Read more
Source§fn visit_infobox(&mut self, _name: &str, _value: &str)
fn visit_infobox(&mut self, _name: &str, _value: &str)
Called when encountering an infobox field. Read more
Source§fn visit_reference(&mut self, _id: &str, _ref_type: &str, _metadata: &Value)
fn visit_reference(&mut self, _id: &str, _ref_type: &str, _metadata: &Value)
Called when encountering a reference. Read more
Source§fn visit_article_end(&mut self)
fn visit_article_end(&mut self)
Called when finished processing an article. Read more
Auto Trait Implementations§
impl Freeze for StatsVisitor
impl RefUnwindSafe for StatsVisitor
impl Send for StatsVisitor
impl Sync for StatsVisitor
impl Unpin for StatsVisitor
impl UnsafeUnpin for StatsVisitor
impl UnwindSafe for StatsVisitor
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