Rust trait with lifetime, type, const and associated type arguments
Show HN: Rust trait with lifetime, type, const and associated type arguments
Based, Rust trait with lifetime, type, const and associated type arguments works in show hn launch.
Profile
Basically wrap your data struct in Option<Rc<RefCell<_>>>Better yet, use your custom type that provides few helper functions that make using it as nice as old C++ pointers.Obviously there's no pointer arithmetic, but it works great for dynamically allocated structures like trees or linked lists.Please comment how it's a horrible idea that will bring doom to me and my family. fn main() { struct Data { pub number: i32 } // struct Data { int number; }; let mut p:Pointer<Data> = Pointer(None); // Data *p = NULL; println!("{}", p.is_none()); // printf(p == NULL ? "true\n" : "false\n"); p = Pointer::new(Data { number: 5 }); // p = new Data { number: 5 }; println!("{}", p.pointed().number); // prin
Its activity falls under show hn launch; the profile below is assembled from public directory data.
The company is listed at the Show HN launch stage of development.
| Sector | Show HN launch |
|---|---|
| Stage | Show HN launch |
Website: play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c271ff5fa9f1ea05ecb37e5a23630069
Browse related
Create a free account