Skip to main content

Module pattern

Module pattern 

Source
Expand description

Mutt-style search/limit patterns. Terms: ~f from, ~s subject, ~b body, ~t to, ~c cc, ~C to-or-cc, ~e sender, ~h any header, ~i Message-ID, ~x References, ~d date, ~r received date, ~m index range, ~z size range, ~= duplicate, ~N new, ~F flagged, ~D deleted, ~U unread, ~T tagged, ~l addressed to a known mailing list, ~p addressed to me, ~P sent by me, ~A every message; a bare word matches subject or from (mutt’s $simple_search). Adjacent terms AND, | ORs, ! negates, () groups; string arguments are case-insensitive regexes (quote them to include spaces), ~d/~r take DD/MM/YYYY ranges or </>/= offsets like <1w.

Structs§

Matcher
A string argument: tried as a case-insensitive regex; an invalid regex degrades to a case-insensitive substring match.
Me
Which addresses count as mine: the exact ones the identity layers name (bare, lowercase) plus mutt’s alternates, regexes over the bare address. Everything that asks “is this me?” goes through here: ~p and ~P, the +/T/C/F index marks, reverse_name, the group-reply dedup, and Mail-Followup-To.
Position
What a message needs from the list around it: its index number for ~m and whether its Message-ID repeats for ~=. Matching without a list (a single color rule, say) leaves this at its default, where both terms are false.
Scope
Everything matching needs besides the message: my own addresses (~p, ~P), the known mailing lists (~l), and the message’s place in the list (~m, ~=).
ThreadView
One message’s neighbours in the thread, by index into envs.

Enums§

Bound
One end of a ~m range: a literal number, or mutt’s . (the selected message) and $ (the last), resolved at match time.
Pattern

Traits§

EnvSource
Where a thread term finds the other messages: a session’s list, or a plain slice in a test.

Functions§

body_terms
Every ~b argument in the pattern, for pre-resolving on a server.
matches
AND of the top-level patterns. me are my own bare lowercase addresses, for ~p.
matches_in
The full entry point: scope answers the terms a lone message cannot (~p, ~l, ~m, ~=).
matches_via
Like matches, with ~b optionally answered by oracle (server-side IMAP search) instead of reading the file.
parse
Top-level terms (implicitly ANDed, like mutt).

Type Aliases§

BodyOracle
Answers ~b for a message without the local file read: Some when a server-side search already knows, None to fall back.