1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use core::{BoundedSpace, Space, Card};
use std::fmt;

/// Type representing the set of natural numbers, N.
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
pub struct Naturals;

impl Space for Naturals {
    type Value = u64;

    fn dim(&self) -> usize { 1 }

    fn card(&self) -> Card { Card::Infinite }
}

impl BoundedSpace for Naturals {
    type BoundValue = Self::Value;

    fn inf(&self) -> Option<u64> { Some(1) }

    fn sup(&self) -> Option<u64> { None }

    fn contains(&self, val: Self::BoundValue) -> bool { val > 0 }
}

impl fmt::Display for Naturals {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "\u{2115}")
    }
}