From 242b9fa262efed32d683a5c3f4d98e117e3706d8 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Wed, 20 Apr 2022 10:17:02 -0700 Subject: [PATCH] Enable PRETTIERMARKDOWN Summary: Enables Markdown formatting and fixes all outstanding issues. Reviewed By: d16r Differential Revision: D35781518 fbshipit-source-id: 038fae2727f36739cfa4234218d88fef27e6e7fb --- CONTRIBUTING.md | 18 +++++++++++------ README.md | 16 ++++++++++------ shed/hash_memo/README.md | 33 +++++++++++++++++--------------- shed/sorted_vector_map/README.md | 31 ++++++++++++++++-------------- 4 files changed, 57 insertions(+), 41 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4bb7f927..10dbd301 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,12 +1,15 @@ # Contributing to rust-shed + We want to make contributing to this project as easy and transparent as possible. ## Our Development Process + External pull requests are first applied to facebook's internal branch, then synced with rust-shed github repository. ## Pull Requests + We actively welcome your pull requests. 1. Fork the repo and create your branch from `master`. @@ -17,12 +20,14 @@ We actively welcome your pull requests. 6. If you haven't already, complete the Contributor License Agreement ("CLA"). ## Contributor License Agreement ("CLA") + In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Facebook's open source projects. Complete your CLA here: ## Issues + We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue. @@ -31,6 +36,7 @@ disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue. ## Coding Style + Keep `use` statements sorted in the following order: 1. Imports from external crates. @@ -43,8 +49,8 @@ Within each subgroup, `use` statements should be in alphabetical order. Use [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt/) to format your code. This means: -* 4 spaces for indentation rather than tabs -* 80 character line length recommended, up to 100 characters if necessary. +- 4 spaces for indentation rather than tabs +- 80 character line length recommended, up to 100 characters if necessary. This project uses the `rustfmt` currently based on nightly Rust (`rustfmt-nightly` as of June 2017). For instructions on how to install it, see @@ -52,7 +58,7 @@ the [`rustfmt` README](https://github.com/rust-lang-nursery/rustfmt/#installation). ## License -By contributing to rust-shed, you agree that your contributions will be -licensed under both the [LICENSE-MIT](LICENSE-MIT) and -[LICENSE-APACHE](LICENSE-APACHE) files in the root directory of this source -tree. + +By contributing to rust-shed, you agree that your contributions will be licensed +under both the [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) +files in the root directory of this source tree. diff --git a/README.md b/README.md index 18862790..acbacf86 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,20 @@ open source projects (like Mononoke or Eden). You can use `cargo` to build and test the project. -When using `thrift_compiler` you have to have fbthrfit compiler installed. -For MacOS/Unix to install it inside `$HOME/build` do: +When using `thrift_compiler` you have to have fbthrfit compiler installed. For +MacOS/Unix to install it inside `$HOME/build` do: + ``` [rust-shed]$ mkdir $HOME/build [rust-shed]$ ./build/fbcode_builder/getdeps.py build fbthrift --install-prefix $HOME/build ``` -After that add `THRIFT=$HOME/build/fbthrift/bin/thrift1` to your environment or make sure -`thrift1` is accessible by adding `$HOME/build/fbthrift/bin` to `PATH`. + +After that add `THRIFT=$HOME/build/fbthrift/bin/thrift1` to your environment or +make sure `thrift1` is accessible by adding `$HOME/build/fbthrift/bin` to +`PATH`. Alternatively you can build and run tests with: + ``` [rust-shed]$ ./build/fbcode_builder/getdeps.py build rust-shed [rust-shed]$ ./build/fbcode_builder/getdeps.py test rust-shed @@ -37,5 +41,5 @@ See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out. ## License -rust-shed is both MIT and Apache License, Version 2.0 licensed, as found -in the [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) files. +rust-shed is both MIT and Apache License, Version 2.0 licensed, as found in the +[LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) files. diff --git a/shed/hash_memo/README.md b/shed/hash_memo/README.md index 3e7d5fd9..ff564e38 100644 --- a/shed/hash_memo/README.md +++ b/shed/hash_memo/README.md @@ -1,27 +1,30 @@ -# hash\_memo +# hash_memo -`hash_memo` contains implementations of `std::hash::BuildHasher`, `std::hash::Hash`, and `std::hash::Hasher` -that can memoize the `Hasher::finish()` values to save recomputing them. +`hash_memo` contains implementations of `std::hash::BuildHasher`, +`std::hash::Hash`, and `std::hash::Hasher` that can memoize the +`Hasher::finish()` values to save recomputing them. -`hash_memo::EagerHashMemoizer` can wrap your type `T` to eagerly memoize your hash value. This is ideal -when you know you are immediately going to use it with somthing that will call `Hash::hash()`, for example -you are going to use is as a key in a `HashMap`. +`hash_memo::EagerHashMemoizer` can wrap your type `T` to eagerly memoize your +hash value. This is ideal when you know you are immediately going to use it with +somthing that will call `Hash::hash()`, for example you are going to use is as a +key in a `HashMap`. -`hash_memo::LazyHashMemoizer` can do similar, but is useful if you are not sure if `Hash::hash()` will be called -and you want to defer the cost. +`hash_memo::LazyHashMemoizer` can do similar, but is useful if you are not sure +if `Hash::hash()` will be called and you want to defer the cost. -`hash_memo::BuildMemoHasher` provides a way to construct a wrapper of a `std::hash::Hasher`s so that the memoized -`Hasher::finish()` values are identical to the non-memoized values. This is useful if you are going to look up -a map by both the wrapped memoized value and via `std::borrow::Borrow::borrow()` to `&T`. +`hash_memo::BuildMemoHasher` provides a way to construct a wrapper of a +`std::hash::Hasher`s so that the memoized `Hasher::finish()` values are +identical to the non-memoized values. This is useful if you are going to look up +a map by both the wrapped memoized value and via `std::borrow::Borrow::borrow()` +to `&T`. `hash_memo` is part of -[rust-shed](https://github.com/facebookexperimental/rust-shed). See the rust-shed -repository for more documentation, including the contributing guide. +[rust-shed](https://github.com/facebookexperimental/rust-shed). See the +rust-shed repository for more documentation, including the contributing guide. ## License -hash\_memo is both MIT and Apache License, Version 2.0 licensed, as -found in the +hash_memo is both MIT and Apache License, Version 2.0 licensed, as found in the [LICENSE-MIT](https://github.com/facebookexperimental/rust-shed/blob/master/LICENSE-MIT) and [LICENSE-APACHE](https://github.com/facebookexperimental/rust-shed/blob/master/LICENSE-APACHE) diff --git a/shed/sorted_vector_map/README.md b/shed/sorted_vector_map/README.md index 7769ded4..2251733c 100644 --- a/shed/sorted_vector_map/README.md +++ b/shed/sorted_vector_map/README.md @@ -1,27 +1,30 @@ -# sorted\_vector\_map +# sorted_vector_map `sorted_vector_map` is an implementation of an ordered map and set (like -`std::collections::BTreeMap` and `std::collections::BTreeSet`) using a sorted vector as the backing store. +`std::collections::BTreeMap` and `std::collections::BTreeSet`) using a sorted +vector as the backing store. -Sorted vector maps are appropriate when data is frequently loaded from an ordered source, -queried a small number of times, and infrequently modified through insertion or removal. +Sorted vector maps are appropriate when data is frequently loaded from an +ordered source, queried a small number of times, and infrequently modified +through insertion or removal. -Loading from an ordered sequence is *O(n)* through an optimization to `insert` that handles -in-order insertions specially. Extension of the sequence is also optimized, -where extending a map or set of size n with m elements in a single operation is -*O(n + m log m)*. Otherwise, loading from an unordered sequence is *O(n^2)*. +Loading from an ordered sequence is _O(n)_ through an optimization to `insert` +that handles in-order insertions specially. Extension of the sequence is also +optimized, where extending a map or set of size n with m elements in a single +operation is _O(n + m log m)_. Otherwise, loading from an unordered sequence is +_O(n^2)_. -Look-up is *O(log n)* through binary search. Insertion and removal are both *O(n)*, as -are set operations like intersection, union and difference. +Look-up is _O(log n)_ through binary search. Insertion and removal are both +_O(n)_, as are set operations like intersection, union and difference. `sorted_vector_map` is part of -[rust-shed](https://github.com/facebookexperimental/rust-shed). See the rust-shed -repository for more documentation, including the contributing guide. +[rust-shed](https://github.com/facebookexperimental/rust-shed). See the +rust-shed repository for more documentation, including the contributing guide. ## License -sorted\_vector\_map is both MIT and Apache License, Version 2.0 licensed, as -found in the +sorted_vector_map is both MIT and Apache License, Version 2.0 licensed, as found +in the [LICENSE-MIT](https://github.com/facebookexperimental/rust-shed/blob/master/LICENSE-MIT) and [LICENSE-APACHE](https://github.com/facebookexperimental/rust-shed/blob/master/LICENSE-APACHE)