Functions that produce one-line summaries of Gmail filter criteria and actions for display.
// Source: https://github.com/pimalaya/himalaya | License: Apache-2.0 | Copyright 2022-2026 soywod <pimalaya.org@posteo.net>
// Provided via justclaw.it.com; keep this notice with the code.
//! # Gmail filter summary
//!
//! Renders a filter's match criteria as the one line its listing
//! shows.
use io_gmail::v1::rest::settings::filters::{GmailFilterAction, GmailFilterCriteria};
use pimalaya_cli::table::sanitize;
/// Best-effort one-line summary of a filter's match criteria.
pub fn criteria_summary(criteria: &GmailFilterCriteria) -> String {
let mut parts = Vec::new();
if let Some(from) = &criteria.from {
parts.push(format!("from={from}"));
}
if let Some(to) = &criteria.to {
parts.push(format!("to={to}"));
}
if let Some(subject) = &criteria.subjec
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key