jpetkau / genrc Goto Github PK
View Code? Open in Web Editor NEWRust alternatives to Arc/Rc that behave like C++ shared_ptr
License: Apache License 2.0
Rust alternatives to Arc/Rc that behave like C++ shared_ptr
License: Apache License 2.0
I'm not super happy with the Rcl
/ Arcl
types. Several alternate approaches
are possible but they all have their own tradeoffs.
If it was possible to default lifetimes, then Rcl
could be named Rc
and
the lifetime param just defaulted to static.
https://internals.rust-lang.org/t/lifetime-parameter-default-value/1722.
Maybe someday.
type Rc<'a, T> = Genrc<'a, T, ...>
, i.e. only have the lifetime-containing
version. This works fine in normal code, but now you need an explicit
'static
or 'a
in any structs containing Rc
so it's much less of a
drop-in replacement, and it's kinda ugly. (Cow<'static, T>
has the same
problem.)
Make Rc<T>
contain a phantom T instead of a phantom &T
, and Rcl<T>
a
completely different type. This makes Rc
a better drop-in replacement for
std::rc::Rc
, but means there must be two different Rc::project()
functions, one that erases the lifetime and one that doesn't, and it's harder
to write generic code over both.
Make the general version Rc<T, L>
, replacing the lifetime parameter with
a type that might have a lifetime, e.g. Rc<i32, &'a i32>
. But now the
type L contains too much info; we really want it to be either ()
or
&'a ()
, but there's no convert an arbitrary lifetime-containing type to
a minimal type that just expresses the lifetimes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.