translate class into rust: struct, trait, and impl