Method Create
- Namespace
- MailFathom.Domain.Emails
- Assembly
- MailFathom.Domain.dll
Create(IEnumerable<string>?)
Builds the keyword set from what a server reported.
public static RemoteEmailKeywords Create(IEnumerable<string>? keywords)
Parameters
keywordsIEnumerable<string>The keywords as the server wrote them, in any order, or null when it reported none.
Returns
- RemoteEmailKeywords
The normalized set, which is None when nothing usable was reported.
Remarks
A keyword that is empty, carries a control character, or is longer than MaximumKeywordLength is dropped, and so is everything past MaximumKeywords once the rest are ordered. Which keywords the bound gives up is therefore decided by the value rather than by the order one server happened to answer in, so two runs against the same message keep the same ones.
The bound is applied while the answer is read rather than to the set it produced, which is what makes it a bound: the kept keywords are held in an ordered set that gives up its greatest value as soon as it holds one too many, so a server reporting a million flags costs this parse the memory of the sixty-four it keeps rather than the memory of the million it sent. Deduplication comes from the same set, so nothing is collected twice either.