git.delta.rocks / unique-network / refs/commits / d4b9e94c5b52

difftreelog

source

crates/evm-coder/src/solidity/traits.rs1.2 KiBsourcehistory
1use super::TypeCollector;2use core::fmt;34pub trait StructCollect: 'static {5	/// Structure name.6	fn name() -> String;7	/// Structure declaration.8	fn declaration() -> String;9}1011pub trait SolidityTypeName: 'static {12	fn solidity_name(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;13	/// "simple" types are stored inline, no `memory` modifier should be used in solidity14	fn is_simple() -> bool;15	fn solidity_default(writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;16	/// Specialization17	fn is_void() -> bool {18		false19	}20}2122pub trait SolidityType {23	fn names(tc: &TypeCollector) -> Vec<String>;24	fn len() -> usize;25}2627pub trait SolidityArguments {28	fn solidity_name(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;29	fn solidity_get(&self, prefix: &str, writer: &mut impl fmt::Write) -> fmt::Result;30	fn solidity_default(&self, writer: &mut impl fmt::Write, tc: &TypeCollector) -> fmt::Result;31	fn is_empty(&self) -> bool {32		self.len() == 033	}34	fn len(&self) -> usize;35}3637pub trait SolidityFunctions {38	fn solidity_name(39		&self,40		is_impl: bool,41		writer: &mut impl fmt::Write,42		tc: &TypeCollector,43	) -> fmt::Result;44}