use near_sdk::{BorshStorageKey, IntoStorageKey, borsh::BorshSerialize}; pub trait NestPrefix: Sized + IntoStorageKey { fn nest(self, nested: S) -> NestedPrefix where S: BorshSerialize, { NestedPrefix { parent: self, nested, } } } impl NestPrefix for T where T: IntoStorageKey {} #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, BorshSerialize, BorshStorageKey)] #[borsh(crate = "::near_sdk::borsh")] pub struct NestedPrefix { parent: S, nested: P, }