Skip to content

Instantly share code, notes, and snippets.

@wycats

wycats/survey.md Secret

Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wycats/2957ea3090349640b417 to your computer and use it in GitHub Desktop.
Save wycats/2957ea3090349640b417 to your computer and use it in GitHub Desktop.
src/libregex/re.rs:724:    pub fn name(&self, name: &str) -> &'t str {

Equivalent to the shorthand.

src/librustc/back/archive.rs:239:    pub fn read<'a>(&'a self, file: &str) -> Option<&'a [u8]> {

Essentially an indexing operation (read a file from the archive)

src/libsyntax/ext/base.rs:671:    pub fn find<'a>(&'a self, k: &Name) -> Option<&'a SyntaxExtension> {

Indexing.

src/libserialize/json.rs:818:    pub fn find<'a>(&'a self, key: &String) -> Option<&'a Json>{
src/libserialize/json.rs:828:    pub fn find_path<'a>(&'a self, keys: &[&String]) -> Option<&'a Json>{
src/libserialize/json.rs:842:    pub fn search<'a>(&'a self, key: &String) -> Option<&'a Json> {

Indexing.

src/libstd/io/process.rs:155:    pub fn args<'a, T:ToCStr>(&'a mut self, args: &[T]) -> &'a mut Command {
src/libstd/io/process.rs:170:    pub fn env<'a, T:ToCStr>(&'a mut self, env: &[(T,T)]) -> &'a mut Command {
src/libstd/io/process.rs:178:    pub fn cwd<'a>(&'a mut self, dir: &Path) -> &'a mut Command {

Builder pattern.

src/libstd/collections/hashmap.rs:292:        pub fn read<'a>(&'a self, index: &FullIndex) -> (&'a K, &'a V) {
src/libstd/collections/hashmap.rs:303:        pub fn read_mut<'a>(&'a mut self, index: &FullIndex) -> (&'a K, &'a mut V) {

Indexing. Borrows key and value from self for a given internal "index".

src/libstd/collections/hashmap.rs:950:    fn find<'a>(&'a self, k: &K) -> Option<&'a V> {
src/libstd/collections/hashmap.rs:963:    fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
src/libstd/collections/hashmap.rs:1328:    pub fn get<'a>(&'a self, k: &K) -> &'a V {
src/libstd/collections/hashmap.rs:1336:    pub fn get_mut<'a>(&'a mut self, k: &K) -> &'a mut V {
src/libstd/collections/hashmap.rs:1351:    pub fn find_equiv<'a, Q: Hash<S> + Equiv<K>>(&'a self, k: &Q) -> Option<&'a V> {

Various indexing.

src/libstd/collections/lru_cache.rs:140:    pub fn get<'a>(&'a mut self, k: &K) -> Option<&'a V> {

Indexing.

src/libcore/ops.rs:627: *     fn index<'a>(&'a self, _rhs: &Foo) -> &'a Foo {
src/libcore/ops.rs:659: *     fn index_mut<'a>(&'a mut self, _rhs: &Foo) -> &'a mut Foo {

Indexing.

src/libcollections/smallintmap.rs:53:    fn find<'a>(&'a self, key: &uint) -> Option<&'a V> {
src/libcollections/smallintmap.rs:67:    fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut V> {
src/libcollections/smallintmap.rs:132:    pub fn get<'a>(&'a self, key: &uint) -> &'a V {

Indexing.

src/libcollections/trie.rs:61:    fn find<'a>(&'a self, key: &uint) -> Option<&'a T> {
src/libcollections/trie.rs:84:    fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut T> {

Indexing.

src/libcollections/treemap.rs:93:    fn find<'a>(&'a self, key: &K) -> Option<&'a V> {
src/libcollections/treemap.rs:101:    fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> {

Indexing.

src/libcollections/bitv.rs:86:    fn index<'a>(&'a self, i: &uint) -> &'a bool {

Indexing.

src/librand/lib.rs:235:    fn choose<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {
src/librand/lib.rs:245:    fn choose_option<'a, T>(&mut self, values: &'a [T]) -> Option<&'a T> {

Does not follow the shorthand rule. Slice::sample() would.

src/librustc/middle/trans/cleanup.rs:864:    fn trans<'a>(&self, bcx: &'a Block<'a>) -> &'a Block<'a> {
src/librustc/middle/trans/cleanup.rs:893:    fn trans<'a>(&self, bcx: &'a Block<'a>) -> &'a Block<'a> {

Does not follow the shorthand rule. This is actually a builder pattern on the bcx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment