pub enum ValidationError {
Show 41 variants
NoModuleName,
DuplicateModuleName(String),
InvalidModuleName(String, &'static str),
DuplicateFunctionName {
module: String,
function: String,
},
DuplicateParamName {
module: String,
function: String,
param: String,
},
ReservedKeyword(String),
InvalidIdentifier(String, &'static str),
ErrorDomainMissingName(String),
DuplicateErrorName {
module: String,
name: String,
},
DuplicateErrorCode {
module: String,
code: i32,
},
InvalidErrorCode {
module: String,
name: String,
},
NameCollisionWithErrorDomain {
module: String,
name: String,
},
SymbolCollision {
symbol: String,
first: String,
second: String,
},
CancellableNotAsync {
module: String,
function: String,
},
ThrowsWithoutErrorDomain {
module: String,
function: String,
},
DuplicateTypeName {
name: String,
first: String,
second: String,
},
DuplicateErrorCodeName {
name: String,
first: String,
second: String,
},
DuplicateStructName {
module: String,
name: String,
},
DuplicateStructField {
struct_name: String,
field: String,
},
EmptyStruct {
module: String,
name: String,
},
DuplicateEnumName {
module: String,
name: String,
},
EmptyEnum {
module: String,
name: String,
},
DuplicateEnumVariant {
enum_name: String,
variant: String,
},
DuplicateEnumVariantField {
enum_name: String,
variant: String,
field: String,
},
DuplicateEnumValue {
enum_name: String,
value: i32,
},
DuplicateInterfaceName {
module: String,
name: String,
},
DuplicateInterfaceMember {
interface: String,
name: String,
},
EmptyInterface {
module: String,
name: String,
},
ConstructorHasReturn {
interface: String,
constructor: String,
},
AsyncConstructor {
interface: String,
constructor: String,
},
InterfaceInInvalidPosition {
name: String,
location: String,
},
UnknownTypeRef {
name: String,
},
InvalidMapKey {
key_type: String,
},
IteratorInInvalidPosition {
location: String,
},
DuplicateCallbackInterfaceName {
module: String,
name: String,
},
EmptyCallbackInterface {
module: String,
name: String,
},
DuplicateCallbackMethod {
interface: String,
name: String,
},
InvalidCallbackMethod {
interface: String,
method: String,
reason: &'static str,
},
CallbackInterfaceInInvalidPosition {
name: String,
location: String,
},
AsyncIteratorReturn {
module: String,
function: String,
},
UnsupportedSchemaVersion {
version: String,
supported: String,
},
}Expand description
Every way an Api can fail validation.
validate_api collects every variant it encounters. Each variant carries
the names needed to render an actionable diagnostic, and the
#[error]/#[diagnostic] attributes supply the message and help text
shown to the user.
Variants§
NoModuleName
A module is missing its required name field.
DuplicateModuleName(String)
Two modules share the same name.
InvalidModuleName(String, &'static str)
A module name is not a valid identifier; the second field explains why.
DuplicateFunctionName
Two functions in the same module share a name.
Fields
DuplicateParamName
Two parameters of one function share a name.
Fields
ReservedKeyword(String)
A name matches a reserved keyword in one of the target languages.
InvalidIdentifier(String, &'static str)
An identifier is malformed; the second field explains why.
ErrorDomainMissingName(String)
An error domain in the named module is missing its name field.
DuplicateErrorName
Two error codes in the same module share a name.
Fields
DuplicateErrorCode
Two error codes in the same module share a numeric value.
Fields
InvalidErrorCode
An error code uses a reserved value: 0 means success and the
negative range belongs to the runtime’s trap codes.
Fields
NameCollisionWithErrorDomain
A function name collides with an error domain name in the same module.
Fields
SymbolCollision
Two declarations lower to the same C identifier.
Every function, type, constant, and runtime name in the C ABI starts
with the library prefix and is flattened from its module path, so
m.x_y, m.x.y, and m_x.y all become {prefix}_m_x_y, and an
async foo’s completion type {prefix}_m_foo_callback collides with
a function named foo_callback.
Fields
CancellableNotAsync
A synchronous callable declares cancellable: true.
ThrowsWithoutErrorDomain
A function declares throws: true but no error domain is in scope.
Fields
DuplicateTypeName
Two types (structs, enums, interfaces, or callback interfaces) share a bare name.
Type names must be unique across the whole API: generators emit flat
per-language type names, and unqualified cross-module references
resolve by bare name, so two types called Config would collide in
generated code and make references ambiguous.
Fields
DuplicateErrorCodeName
Two error domains declare a code with the same name.
Code names must be unique across every domain in the API: backends
with flat namespaces (Python, Node, Go) derive one error class or
constant per code, so NotFound in two domains would collide in
generated code.
Fields
DuplicateStructName
Two structs in the same module share a name.
DuplicateStructField
Two fields of one struct share a name.
Fields
EmptyStruct
A struct declares no fields.
DuplicateEnumName
Two enums in the same module share a name.
EmptyEnum
An enum declares no variants.
DuplicateEnumVariant
Two variants of one enum share a name.
Fields
DuplicateEnumVariantField
Two associated fields of one rich enum variant share a name.
Fields
DuplicateEnumValue
Two variants of one enum share a numeric discriminant.
Fields
DuplicateInterfaceName
Two interfaces in the same module share a name.
DuplicateInterfaceMember
Two members (constructors, methods, or statics) of one interface share a name.
Fields
EmptyInterface
An interface declares no members at all.
ConstructorHasReturn
An interface constructor declares an explicit return type.
Fields
AsyncConstructor
An interface constructor is marked async.
Fields
InterfaceInInvalidPosition
An interface reference appears as a map key.
Fields
UnknownTypeRef
A type reference names a struct, enum, interface, or callback interface that doesn’t exist.
InvalidMapKey
A map uses a key type the C ABI can’t represent.
IteratorInInvalidPosition
An iterator type appears somewhere other than a function return.
DuplicateCallbackInterfaceName
Two callback interfaces in the same module share a name.
Fields
EmptyCallbackInterface
A callback interface declares no methods.
Fields
DuplicateCallbackMethod
Two methods of one callback interface share a name.
Fields
InvalidCallbackMethod
A callback-interface method uses a flag or return type the callback
ABI can’t carry. The reason names the offending feature.
Fields
CallbackInterfaceInInvalidPosition
A callback-interface type appears in a position other than a callable parameter.
Fields
AsyncIteratorReturn
An async function tries to return an iterator, which has no async ABI.
Fields
UnsupportedSchemaVersion
The document declares a schema version this build doesn’t support.
Trait Implementations§
Source§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Diagnostic for ValidationError
impl Diagnostic for ValidationError
Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn code<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic.Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeDiagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more