Struct PresentationText
- Namespace
- MailFathom.Application.Discovery.Presentation
- Assembly
- MailFathom.Application.dll
Holds the only kind of free text a presentation plan may carry: plain text a client draws as text.
[JsonConverter(typeof(PresentationTextJsonConverter))]
public readonly record struct PresentationText : IEquatable<PresentationText>
- Implements
- Inherited Members
Remarks
Every text a plan holds passes through this type, which is what makes "a plan is never code" a property of the
contract rather than a rule a reviewer applies. Two things are refused. A value that is markup — one whose
content opens with < and closes with > — is refused outright, because that is the shape a model
returning a fragment of XAML, HTML, or SVG produces and there is no reading of it as prose. Control characters are
refused beside it, because a plan reaches a renderer, a log, and a screen reader, and none of those three agrees on
what one means.
What it deliberately does not do is sanitize text that merely mentions an angle bracket. A fragment quoted from mail legitimately contains one, the client draws this value into a typed text element rather than into a parser, and a contract that mangled a quotation to defend a renderer that never evaluates anything would be trading a real defect for an imagined one.
The length bound is the plan's own rather than a screen's. No block in the catalogue presents a message body — the plan cites one instead — so a text longer than a paragraph is a model writing an essay into a table cell, and refusing it here is cheaper than every renderer deciding separately where to cut. Being a struct, default is reachable and is not text: it reports itself through IsSpecified and is refused by the converter and by every contract member that requires a value.
Fields
- MaxLength
The greatest number of characters one text may hold.
Properties
- IsSpecified
Gets whether this value holds text rather than the unusable struct default.
- Value
Gets the text, which is never blank, never markup, and never carries a control character.
Methods
- Create(string?)
Creates a text a plan may carry.
- ToString()
Returns the fully qualified type name of this instance.
- TryCreate(string?, out PresentationText)
Creates a text a plan may carry, reporting whether the value was acceptable instead of throwing.