clockwork_anchor_idl/
lib.rs1pub use anchor_syn::idl::*;
4
5mod account;
6mod instruction;
7mod program;
8mod state;
9mod typedef;
10
11pub use account::*;
12pub use instruction::*;
13pub use program::*;
14pub use state::*;
15pub use typedef::*;
16
17pub const GEN_VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
19
20pub fn ty_to_rust_type(ty: &IdlType) -> String {
22 match ty {
23 IdlType::Bool => "bool".to_string(),
24 IdlType::U8 => "u8".to_string(),
25 IdlType::I8 => "i8".to_string(),
26 IdlType::U16 => "u16".to_string(),
27 IdlType::I16 => "i16".to_string(),
28 IdlType::U32 => "u32".to_string(),
29 IdlType::I32 => "i32".to_string(),
30 IdlType::F32 => "f32".to_string(),
31 IdlType::U64 => "u64".to_string(),
32 IdlType::I64 => "i64".to_string(),
33 IdlType::F64 => "f64".to_string(),
34 IdlType::U128 => "u128".to_string(),
35 IdlType::I128 => "i128".to_string(),
36 IdlType::U256 => "u256".to_string(),
37 IdlType::I256 => "i256".to_string(),
38 IdlType::Bytes => "Vec<u8>".to_string(),
39 IdlType::String => "String".to_string(),
40 IdlType::PublicKey => "Pubkey".to_string(),
41 IdlType::Option(inner) => format!("Option<{}>", ty_to_rust_type(inner)),
42 IdlType::Vec(inner) => format!("Vec<{}>", ty_to_rust_type(inner)),
43 IdlType::Array(ty, size) => format!("[{}; {}]", ty_to_rust_type(ty), size),
44 IdlType::Defined(name) => name.to_string(),
45 }
46}