pub enum ValidationError {
Show 38 variants
UnsupportedSchemaVersion {
version: String,
supported: String,
},
NoModuleName,
DuplicateModuleName {
module: String,
},
InvalidModuleName {
name: String,
reason: &'static str,
},
ReservedKeyword {
name: String,
},
InvalidIdentifier {
name: String,
reason: &'static str,
},
DuplicateTypeName {
name: String,
first: String,
second: String,
},
DuplicateFunctionName {
name: String,
first: String,
second: String,
},
NameCollisionWithErrorDomain {
name: String,
function: String,
domain: String,
},
DuplicateErrorCodeName {
name: String,
first: String,
second: String,
},
SymbolCollision {
symbol: String,
first: String,
second: String,
},
DuplicateParamName {
module: String,
function: String,
param: String,
},
CancellableNotAsync {
module: String,
function: String,
},
ThrowsWithoutErrorDomain {
module: String,
function: String,
},
AsyncIteratorReturn {
module: String,
function: String,
},
ErrorDomainMissingName {
module: String,
},
DuplicateErrorCode {
module: String,
value: i32,
},
InvalidErrorCode {
module: String,
name: String,
},
EmptyStruct {
module: String,
name: String,
},
DuplicateStructField {
struct_name: String,
field: 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,
},
EmptyInterface {
module: String,
name: String,
},
DuplicateInterfaceMember {
interface: String,
name: String,
},
ConstructorHasReturn {
interface: String,
constructor: String,
},
AsyncConstructor {
interface: String,
constructor: String,
},
EmptyCallbackInterface {
module: String,
name: String,
},
DuplicateCallbackMethod {
interface: String,
name: String,
},
InvalidCallbackMethod {
interface: String,
method: String,
reason: &'static str,
},
UnknownTypeRef {
name: String,
},
QualifiedTypeRef {
name: String,
},
UnsupportedPrimitive {
name: String,
},
InvalidMapKey {
key_type: String,
},
InterfaceInInvalidPosition {
name: String,
location: String,
},
CallbackInterfaceInInvalidPosition {
name: String,
location: String,
},
IteratorInInvalidPosition {
location: String,
},
}Expand description
Every way an Api can fail validation.
validate 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. Module fields hold the module’s dotted path
(outer.inner). The variant serializes as an object whose code is the
variant name, with the variant’s fields alongside (the shape of
weaveffi validate --format json failures).
Variants§
UnsupportedSchemaVersion
The document declares a schema version this build doesn’t support.
Fields
NoModuleName
A module is missing its required name field.
DuplicateModuleName
Two sibling modules share a name.
InvalidModuleName
A module name is not a valid identifier.
ReservedKeyword
A name matches a reserved keyword in one of the target languages.
InvalidIdentifier
An identifier is malformed.
DuplicateTypeName
Two types (records, enums, interfaces, callback interfaces, or error domains) share a name.
Type names are global: generators emit flat per-language type names
and a reference names a type by its bare name, so two types called
Config would collide in generated code and make references
ambiguous.
Fields
DuplicateFunctionName
Two free functions share a name.
Function names are global: several targets flatten every module’s
functions into one namespace, so a.open and b.open would collide
there.
Fields
NameCollisionWithErrorDomain
A free function has the same name as an error domain.
Fields
DuplicateErrorCodeName
Two error codes share a name.
Code names are global: 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
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
DuplicateParamName
Two parameters of one function share a name.
Fields
CancellableNotAsync
A synchronous callable declares cancellable: true.
ThrowsWithoutErrorDomain
A function or callback-interface method declares throws: true but
no error domain is in scope.
Fields
AsyncIteratorReturn
An async function tries to return an iterator, which has no async ABI.
Fields
ErrorDomainMissingName
An error domain in the named module is missing its name field.
DuplicateErrorCode
Two error codes in one domain 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
EmptyStruct
A struct declares no fields.
DuplicateStructField
Two fields of one struct share a name.
Fields
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
EmptyInterface
An interface declares no members at all.
DuplicateInterfaceMember
Two members (constructors, methods, or statics) of one interface share a name.
Fields
ConstructorHasReturn
An interface constructor declares an explicit return type.
Fields
AsyncConstructor
An interface constructor is marked async.
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
UnknownTypeRef
A type reference names a struct, enum, interface, or callback interface that doesn’t exist.
QualifiedTypeRef
A type reference is module-qualified (a.b.T).
UnsupportedPrimitive
A type reference names a primitive WeaveFFI doesn’t support.
InvalidMapKey
A map uses a key type the C ABI can’t represent.
InterfaceInInvalidPosition
An interface reference appears as a map key.
Fields
CallbackInterfaceInInvalidPosition
A callback-interface type appears in a position other than a callable parameter.
Fields
IteratorInInvalidPosition
An iterator type appears somewhere other than a function return.
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