INNER CODE UNIT · Rust

flag_count

zly2006/zhihu-plus-plus · aigc-vote-server/src/lib.rs:429

    fn flag_count(&self, content_type: &str, content_id: &str) -> i64 {
        self.flags
            .keys()
            .filter(|key| key.content_type == content_type && key.content_id == content_id)
            .count() as i64
    }

    fn current_version_flag_count(
        &self,
        content_type: &str,
        content_id: &str,
        content_hash: &str,
    ) -> i64 {
        self.flags
            .iter()
            .filter(|(key, record)| {
                key.content_type == content_type
                    && key.content_id == content_id

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…