pub enum DiagMessage {
Str(Cow<'static, str>),
Translated(Cow<'static, str>),
FluentIdentifier(Cow<'static, str>, Option<Cow<'static, str>>),
}
Expand description
Abstraction over a message in a diagnostic to support both translatable and non-translatable diagnostic messages.
Intended to be removed once diagnostics are entirely translatable.
§Non-translatable diagnostic message.
§Translatable message which has been already translated.
Some diagnostics have repeated subdiagnostics where the same interpolated variables would be instantiated multiple times with different values. These subdiagnosticsâ messages are translated when they are added to the parent diagnostic, producing this variant of DiagMessage
.
Given a SubdiagMessage
which may contain a Fluent attribute, create a new DiagMessage
that combines that attribute with the Fluent identifier of self
.
SubdiagMessage
is non-translatable then return the message as a DiagMessage
.self
is non-translatable then return self
âs message.Converts to this type from the input type.
Source§ Source§Converts to this type from the input type.
Source§Translating into a subdiagnostic message from a diagnostic message is a little strange - but the subdiagnostic functions (e.g. span_label
) take a SubdiagMessage
and the subdiagnostic derive refers to typed identifiers that are DiagMessage
s, so need to be able to convert between these, as much as theyâll be converted back into DiagMessage
using with_subdiagnostic_message
eventually. Donât use this other than for the derive.
Converts to this type from the input type.
Source§ Source§Converts to this type from the input type.
Source§ Source§ Source§Tests for self
and other
values to be equal, and is used by ==
.
Tests for !=
. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's âType Layoutâ chapter for details on type layout guarantees.
Size: 48 bytes
Size for each variant:
Str
: 32 bytesTranslated
: 32 bytesFluentIdentifier
: 48 bytesRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4