Skip to content

Commit

Permalink
docs: Add README for Crumbles
Browse files Browse the repository at this point in the history
  • Loading branch information
HDauven committed Aug 16, 2024
1 parent 8a9e545 commit 4c3af10
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 3 deletions.
58 changes: 58 additions & 0 deletions crumbles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Crumbles

[![Repository](https://img.shields.io/badge/github-crumbles-blueviolet?logo=github)](https://github.com/dusk-network/piecrust/tree/main/crumbles)
![Build Status](https://github.com/dusk-network/piecrust/workflows/build/badge.svg)
[![Documentation](https://img.shields.io/badge/docs-crumbles-blue?logo=rust)](https://docs.rs/crumbles)

Crumbles is a Rust library designed for creating and managing copy-on-write memory-mapped regions. This allows for efficient memory handling by tracking changes at page level. It's particularly suitable for scenarios where memory snapshots and reverting to previous states are required.

## Usage

The core fuctionality of Crumbles is provided by the `Mmap` struct. This struct offers methods to manage memory regions, create snapshots and revert/apply changes.

Add `crumbles` as a dependency to your contract project:
```sh
cargo add crumbles
```

To make use of `crumbles`, import the dependency in your project. Example:
```rust
use crumbles::Mmap;
use std::io;

fn main() -> io::Result<()> {
let mut mmap = Mmap::new(65536, 65536)?;

// When first created, the mmap is not dirty.
assert_eq!(mmap.dirty_pages().count(), 0);

mmap[24] = 42;

// After writing a single byte, the page it's on is dirty.
assert_eq!(mmap.dirty_pages().count(), 1);

Ok(())
}

```

## Build and Test

To build and test the crate you will need a
[Rust](https://www.rust-lang.org/tools/install) toolchain. Use the following commands to run the tests:

```sh
cargo test
```

## Release History

To see the release history for this crate, please see the [CHANGELOG](./CHANGELOG.md) file.

## License

This code is licensed under the Mozilla Public License Version 2.0 (MPL-2.0). Please see the [LICENSE](./LICENSE) for further details.

## Contribute

If you want to contribute to this project, please check the [CONTRIBUTING](https://github.com/dusk-network/.github/blob/main/.github/CONTRIBUTING.md) file.
6 changes: 3 additions & 3 deletions piecrust-uplink/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# π-crust Uplink

[![Repository](https://img.shields.io/badge/github-piecrust-blueviolet?logo=github)](https://github.com/dusk-network/piecrust)
[![Repository](https://img.shields.io/badge/github-piecrust%20uplink-blueviolet?logo=github)](https://github.com/dusk-network/piecrust/tree/main/piecrust-uplink)
![Build Status](https://github.com/dusk-network/piecrust/workflows/build/badge.svg)
[![Documentation](https://img.shields.io/badge/docs-piecrust-blue?logo=rust)](https://docs.rs/piecrust-uplink/)
[![Documentation](https://img.shields.io/badge/docs-piecrust%20uplink-blue?logo=rust)](https://docs.rs/piecrust-uplink/)

Piecrust Uplink is the library that allows you to build smart contracts directly on top of Dusk's Piecrust virtual machine.

Expand All @@ -12,7 +12,7 @@ The library allows users of the contract platform to manage the interface and st

Add `piecrust_uplink` as a dependency to your contract project:
```sh
cargo install piecrust_uplink
cargo add piecrust_uplink
```

To make use of `uplink`, import the dependency in your project and mark it as `no_std`:
Expand Down

0 comments on commit 4c3af10

Please sign in to comment.