Skip to main content

Crate cowboy

Crate cowboy 

Source
Expand description

§Cowboy

A safe and convenient container for quick prototyping. (Essentially a wrapper around Arc<RwLock<T>>)

You should probably not use this crate in production, but it’s a fun way to prototype something.

use cowboy::*;

let cowboy = 42.cowboy();
*cowboy.w() = 84;
assert_eq!(*cowboy.r(), 84);

§Sheriff

use cowboy::*;

SHERIFF.register("player1_score", 0_i32.cowboy()); // String key
let score = SHERIFF.get::<_, i32>("player1_score");
*score.w() += 1;
assert_eq!(*score.r(), 1);

(The Sheriff should really not be used in production.)

Structs§

Cowboy
Sheriff
A global registry for Cowboy instances

Statics§

SHERIFF
Global Sheriff instance

Traits§

IntoCowboy