In Scrypto, I have folder structure like:
src/
├── lib.rs
├── script.rs
├── custom_types
│ └── type.rs
In type.rs, I have the following defined:
use sbor::*;
#[derive(TypeId, Encode, Decode, Describe)]
pub struct Date {
year: u8,
day: u8,
month: u8,
}
I want to be able to use the Date struct in script.rs how do I do it?
Organize files like:
src/
├── lib.rs
├── script.rs
├── custom_types
│ └── type.rs
│ └── mod.rs
mod.rs:
pub mod type;
Add the following to script.rs:
use super::custom_types::type::Date;
...
Finally, add the following to lib.rs
mod datatypes;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With