Skip to content

Commit

Permalink
Add IntoAbi trait
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Sep 1, 2023
1 parent d974a07 commit 97b10af
Show file tree
Hide file tree
Showing 11 changed files with 672 additions and 21 deletions.
19 changes: 16 additions & 3 deletions src/abi/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum ParseNamedAbiTypeError {
#[error("invalid type `{ty}`: {error}")]
InvalidType {
/// Parsed ABI type.
ty: String,
ty: Box<str>,
/// ABI type parsing error.
#[source]
error: ParseAbiTypeError,
Expand All @@ -53,12 +53,25 @@ pub enum ParseNamedAbiTypeError {
#[error("unexpected components for `{ty}`")]
UnexpectedComponents {
/// Parsed ABI type.
ty: String,
ty: Box<str>,
},
/// Expected components array for tuple.
#[error("expected components for `{ty}`")]
ExpectedComponents {
/// Parsed ABI type.
ty: String,
ty: Box<str>,
},
}

/// Error type for ABI values unpacking related errors.
#[derive(Debug, Clone, thiserror::Error)]
pub enum AbiError {
/// Expected a different value type.
#[error("expected ABI type `{expected}`, got `{ty}`")]
TypeMismatch {
/// A full signature of the expected type.
expected: Box<str>,
/// A full signature of the received type.
ty: Box<str>,
},
}
2 changes: 1 addition & 1 deletion src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::str::FromStr;

pub use self::traits::{WithAbiType, WithPlainAbiType};
pub use self::traits::{IntoAbi, IntoPlainAbi, WithAbiType, WithPlainAbiType};
pub use self::ty::{AbiHeaderType, AbiType, NamedAbiType, PlainAbiType};
pub use self::value::{AbiHeader, AbiValue, NamedAbiValue, PlainAbiValue};

Expand Down
Loading

0 comments on commit 97b10af

Please sign in to comment.