unitrix/
null.rs

1/// A unit type representing a null value.
2/// 表示空值的单元类型
3///
4/// This type is useful for places where a concrete type is required
5/// but no actual data needs to be stored.
6/// 当需要具体类型但实际上不需要存储数据时,此类型非常有用
7///
8#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Debug, Default, Hash)]
9pub struct Null;
10
11#[cfg(test)]
12mod tests {
13    use super::*;
14    
15    /// Test the default value of Null
16    /// 测试 Null 的默认值
17    #[test]
18    fn test_null_default() {
19        assert_eq!(Null::default(), Null);
20    }
21    
22    /// Test ordering comparison of Null
23    /// 测试 Null 的排序比较
24    #[test]
25    fn test_null_ordering() {
26        assert!(Null <= Null);
27        assert!(Null >= Null);
28        assert!(!(Null < Null));
29        assert!(!(Null > Null));
30    }
31}