Skip to content

Commit

Permalink
Enable PRETTIERMARKDOWN
Browse files Browse the repository at this point in the history
Summary: Enables Markdown formatting and fixes all outstanding issues.

Reviewed By: d16r

Differential Revision: D35781518

fbshipit-source-id: 038fae2727f36739cfa4234218d88fef27e6e7fb
  • Loading branch information
zertosh authored and facebook-github-bot committed Apr 20, 2022
1 parent f673281 commit 242b9fa
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 41 deletions.
18 changes: 12 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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: <https://code.facebook.com/cla>

## 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.

Expand All @@ -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.
Expand All @@ -43,16 +49,16 @@ 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
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.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
33 changes: 18 additions & 15 deletions shed/hash_memo/README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
31 changes: 17 additions & 14 deletions shed/sorted_vector_map/README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 242b9fa

Please sign in to comment.