donkopotamus / rust Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rust-lang/rust
a safe, concurrent, practical language
Home Page: http://www.rust-lang.org
License: Other
This project forked from rust-lang/rust
a safe, concurrent, practical language
Home Page: http://www.rust-lang.org
License: Other
Currently it feels like there is a slight inconsistency in std::slice
between the following traits
Vector
- an object can provide a slice view into itself (as_slice
).ImmutableVector
- an object provides methods for slicing and dicing by integral index.MutableVector
- an object provides both a slice view into itself (as_mut_slice
) and methods for directly manipulating that object.In practice, this means I can write a generic function fn needs_slice<T: Vector>(x: &T)
that manipulate x
only via its as_slice
representation. Then I can easily declare that some new funky object can masquerade as a slice by simply implementing a single method.
Option<T>
implemented Vector
(rather than its own as_slice
) then I could pass one to needs_slice
In contrast, I can also write a function fn needs_mut_slice<T: MutableVector>(x: &T)
that manipulates x
only via its slice representation as_mut_slice
. But I can't declare that some new funky object can masquerade as a mutable slice without adding a bunch of other methods that I don't actually want exposed on that object ... all I really want to do is implement just as_mut_slice
.
So it feels like there should be four traits:
SliceAccessor
- an object can provide a slice view into itself (as_slice
)MutableSliceAccessor
- an object can provide a mutable slice view into itself (as_mut_slice
)ImmutableVector
- an object provides a large number of methods for slicing and dicing itself.MutableVector
- an object provides methods for directly manipulating the object.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.