<commit_before>spin-rs
===========

[![Build Status](https://travis-ci.org/mvdnes/spin-rs.svg)](https://travis-ci.org/mvdnes/spin-rs)
[![Crates.io version](https://img.shields.io/crates/v/spin.svg)](https://crates.io/crates/spin)

[Documentation](https://mvdnes.github.io/rust-docs/spin-rs/spin/index.html)

This Rust library implements a simple
[spinlock](https://en.wikipedia.org/wiki/Mutex).

Usage
-----

By default this crate only works on nightly but you can disable the default features
if you want to run on stable. Nightly is more efficient than stable currently.

Also, `Once` is only available on nightly as it is only useful when `const_fn` is available.

Include the following code in your Cargo.toml

```toml
[dependencies.spin]
version = "0.3"
# If you want to run on stable you will need to add the following:
# default-features = false
```

Example
-------

When calling `lock` on a `Mutex` you will get a reference to the data. When this
reference is dropped, the lock will be unlocked.

```rust
extern crate spin;

fn main()
{
    let mutex   = spin::Mutex::new(0);
    let rw_lock = spin::RwLock::new(0);

    // Modify the data<commit_msg>Update the version number in README<commit_after>spin-rs
===========

[![Build Status](https://travis-ci.org/mvdnes/spin-rs.svg)](https://travis-ci.org/mvdnes/spin-rs)
[![Crates.io version](https://img.shields.io/crates/v/spin.svg)](https://crates.io/crates/spin)

[Documentation](https://mvdnes.github.io/rust-docs/spin-rs/spin/index.html)

This Rust library implements a simple
[spinlock](https://en.wikipedia.org/wiki/Mutex).

Usage
-----

By default this crate only works on nightly but you can disable the default features
if you want to run on stable. Nightly is more efficient than stable currently.

Also, `Once` is only available on nightly as it is only useful when `const_fn` is available.

Include the following code in your Cargo.toml

```toml
[dependencies.spin]
version = "0.4"
# If you want to run on stable you will need to add the following:
# default-features = false
```

Example
-------

When calling `lock` on a `Mutex` you will get a reference to the data. When this
reference is dropped, the lock will be unlocked.

```rust
extern crate spin;

fn main()
{
    let mutex   = spin::Mutex::new(0);
    let rw_lock = spin::RwLock::new(0);

    // Modify the data
{'fraction_non_alphanumeric': 0.14090520922288644, 'fraction_numerical': 0.0034158838599487617, 'mean_word_length': 3.922268907563025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2573818', 'n_tokens_mistral': 775, 'n_tokens_neox': 758, 'n_words': 256}