Skip to content

Commit

Permalink
Better documentation for the moo macro
Browse files Browse the repository at this point in the history
  • Loading branch information
unic0rn9k committed May 2, 2022
1 parent 514a758 commit 7492af1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -31,8 +31,9 @@ which will support custom allocators in the future.

### Example

`StaticCowVecs` can be created both with the `moo` and the `cow_vec` macro.
A `StaticCowVec` can be created both with the `moo` and the `cow_vec` macro.
They have the exact same syntax, but the cow_vec macro is a great choice for the serious programmer.
Better documentation for the moo macro can be found [here](https://docs.rs/slas/latest/slas/macro.moo.html).

```rust
use slas::prelude::*;
Expand Down Expand Up @@ -199,7 +200,7 @@ For now, if you want to use the newest version of slas, you need to install blis
This mean you will need to disable slas default features,
follow the installation instructions in the openblas readme and add `extern crate openblas_src` to your main file.

## Enviroments variables
## Enviroment variables

The backend being chosen to use when none is specified, depends on environments variables set.

Expand Down
23 changes: 15 additions & 8 deletions src/lib.rs
Expand Up @@ -31,8 +31,9 @@
//!
//! ## Example
//!
//! `StaticCowVecs` can be created both with the `moo` and the `cow_vec` macro.
//! A `StaticCowVec` can be created both with the `moo` and the `cow_vec` macro.
//! They have the exact same syntax, but the cow_vec macro is a great choice for the serious programmer.
//! Better documentation for the moo macro can be found [here](https://docs.rs/slas/latest/slas/macro.moo.html).
//!
//! ```rust
//! use slas::prelude::*;
Expand Down Expand Up @@ -199,7 +200,7 @@
//! This mean you will need to disable slas default features,
//! follow the installation instructions in the openblas readme and add `extern crate openblas_src` to your main file.
//!
//! # Enviroments variables
//! # Enviroment variables
//!
//! The backend being chosen to use when none is specified, depends on environments variables set.
//!
Expand Down Expand Up @@ -429,12 +430,18 @@ impl<'a, T: Copy + std::fmt::Debug, const LEN: usize> std::fmt::Debug
/// ## Example
/// ```rust
/// use slas::prelude::*;
/// moo![f32: 1, 2, 3.5];
/// moo![f32: 1..4];
/// moo![f32: 1..=3];
/// moo![0f32; 4];
/// moo![|n|-> f32 { (n as f32).sin() }; 100];
/// moo![|n| (n as f32).sin(); 100];
/// assert_eq!(**moo![f32: 1, 2, 3.5], [1., 2., 3.5]);
/// assert_eq!(**moo![f32: 1..4], [1., 2., 3.]);
/// assert_eq!(**moo![f32: 1..=3], [1., 2., 3.]);
/// assert_eq!(**moo![0f32; 4], [0.; 4]);
///
/// let mut tmp = [0.; 100];
/// for n in 0..100{
/// tmp[n] = (n as f32).sin()
/// }
///
/// assert_eq!(**moo![|n|-> f32 { (n as f32).sin() }; 100], tmp);
/// assert_eq!(**moo![|n| (n as f32).sin(); 100], tmp);
/// ```
#[macro_export]
macro_rules! moo {
Expand Down

0 comments on commit 7492af1

Please sign in to comment.