mirror of
https://github.com/bspeice/qadapt
synced 2024-11-22 05:48:13 -05:00
Minor docs update
This commit is contained in:
parent
dbf24afc67
commit
65808b4e49
2
Makefile
2
Makefile
@ -13,7 +13,7 @@ readme: README.md
|
|||||||
|
|
||||||
README.md: src/lib.rs
|
README.md: src/lib.rs
|
||||||
@sed -i '/---/q' README.md
|
@sed -i '/---/q' README.md
|
||||||
@cat src/lib.rs | grep '//!' | sed 's/^\/\/\! *//g' >> README.md
|
@cat src/lib.rs | grep '//!' | sed -E 's/^\/\/\! ?//g' >> README.md
|
||||||
|
|
||||||
.PHONY: doc
|
.PHONY: doc
|
||||||
doc: readme contributors
|
doc: readme contributors
|
||||||
|
15
README.md
15
README.md
@ -6,9 +6,8 @@
|
|||||||
[![travisci](https://travis-ci.org/bspeice/qadapt.svg?branch=master)](https://travis-ci.org/bspeice/qadapt)
|
[![travisci](https://travis-ci.org/bspeice/qadapt.svg?branch=master)](https://travis-ci.org/bspeice/qadapt)
|
||||||
[![appveyor](https://ci.appveyor.com/api/projects/status/km1p081tkjcptn1w/branch/master?svg=true)](https://ci.appveyor.com/project/bspeice/qadapt/branch/master)
|
[![appveyor](https://ci.appveyor.com/api/projects/status/km1p081tkjcptn1w/branch/master?svg=true)](https://ci.appveyor.com/project/bspeice/qadapt/branch/master)
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
# QADAPT - `debug_assert!` for your memory
|
## `debug_assert!` for your memory usage
|
||||||
|
|
||||||
This allocator is a helper for writing high-performance code that is memory-sensitive;
|
This allocator is a helper for writing high-performance code that is memory-sensitive;
|
||||||
a thread panic will be triggered if a function annotated with `#[no_alloc]`,
|
a thread panic will be triggered if a function annotated with `#[no_alloc]`,
|
||||||
@ -42,7 +41,7 @@ use qadapt::no_alloc;
|
|||||||
|
|
||||||
#[no_alloc]
|
#[no_alloc]
|
||||||
fn do_math() -> u8 {
|
fn do_math() -> u8 {
|
||||||
2 + 2
|
2 + 2
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -51,10 +50,10 @@ fn do_math() -> u8 {
|
|||||||
use qadapt::assert_no_alloc;
|
use qadapt::assert_no_alloc;
|
||||||
|
|
||||||
fn do_work() {
|
fn do_work() {
|
||||||
// This code is allowed to trigger an allocation
|
// This code is allowed to trigger an allocation
|
||||||
let b = Box::new(8);
|
let b = Box::new(8);
|
||||||
|
|
||||||
// This code would panic if an allocation occurred inside it
|
// This code would panic if an allocation occurred inside it
|
||||||
let x = assert_no_alloc!(*b + 2);
|
let x = assert_no_alloc!(*b + 2);
|
||||||
assert_eq!(x, 10);
|
assert_eq!(x, 10);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//! # QADAPT - `debug_assert!` for your memory
|
//! ## `debug_assert!` for your memory usage
|
||||||
//!
|
//!
|
||||||
//! This allocator is a helper for writing high-performance code that is memory-sensitive;
|
//! This allocator is a helper for writing high-performance code that is memory-sensitive;
|
||||||
//! a thread panic will be triggered if a function annotated with `#[no_alloc]`,
|
//! a thread panic will be triggered if a function annotated with `#[no_alloc]`,
|
||||||
|
Loading…
Reference in New Issue
Block a user