Skip to main content

rspec/block/
mod.rs

1//! Blocks are used to build a tree structure of named tests and contextes.
2
3pub mod context;
4pub mod example;
5pub mod suite;
6
7pub use block::context::*;
8pub use block::example::*;
9pub use block::suite::*;
10
11/// Blocks are used to build a tree structure of named tests and contextes.
12pub enum Block<T> {
13    Context(Context<T>),
14    Example(Example<T>),
15}
16
17impl<T> Block<T> {
18    pub fn num_examples(&self) -> usize {
19        match self {
20            Block::Context(ref context) => context.num_examples(),
21            Block::Example(_) => 1,
22        }
23    }
24}
25
26unsafe impl<T> Send for Block<T> where T: Send {}
27unsafe impl<T> Sync for Block<T> where T: Sync {}