Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug,Clone)]
- enum St {
- Long,
- Rect
- }
- #[derive(Debug,Clone)]
- struct Te {
- st:St,
- shape:[[u8;4];2]
- }
- fn new(t:Option<&Te>)->Te {
- t.unwrap().clone()
- }
- fn main() {
- let te=Te {
- st:St::Long,
- shape:[[0,0,0,0],[1,1,1,1]]
- };
- let ter=Some(&te);
- let tec=new(ter);
- println!("{:?},{:?}",ter,tec);
- }
Add Comment
Please, Sign In to add comment