• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TyRoXx / NonlocalityOS / 14775473202

01 May 2025 12:37PM UTC coverage: 76.018% (-1.6%) from 77.667%
14775473202

Pull #221

github

web-flow
Merge ca4cd1402 into e15d5670f
Pull Request #221: Hello world

292 of 372 new or added lines in 9 files covered. (78.49%)

36 existing lines in 7 files now uncovered.

3956 of 5204 relevant lines covered (76.02%)

1811.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

24.0
/lambda/src/types.rs
1
use crate::expressions::{DeepExpression, Expression};
2
use astraea::{
3
    storage::LoadValue,
4
    tree::{BlobDigest, Value},
5
};
6
use serde::{Deserialize, Serialize};
7
use std::{collections::BTreeMap, fmt::Display};
8
use uuid::Uuid;
9

10
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize, Deserialize)]
11
pub struct NamespaceId(pub [u8; 16]);
12

13
impl NamespaceId {
14
    pub fn random() -> Self {
×
15
        Self(Uuid::new_v4().into_bytes())
×
16
    }
17
}
18

19
impl Display for NamespaceId {
20
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11✔
21
        write!(f, "{}", Uuid::from_bytes(self.0))
11✔
22
    }
23
}
24

25
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Serialize, Deserialize)]
26
pub struct Name {
27
    pub namespace: NamespaceId,
28
    pub key: String,
29
}
30

31
impl Name {
32
    pub fn new(namespace: NamespaceId, key: String) -> Self {
28✔
33
        Self { namespace, key }
34
    }
35
}
36

37
impl Display for Name {
38
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11✔
39
        write!(f, "{}.{}", self.namespace, self.key)
11✔
40
    }
41
}
42

43
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Serialize, Deserialize)]
44
pub struct Signature {
45
    pub argument: BlobDigest,
46
    pub result: BlobDigest,
47
}
48

49
impl Signature {
NEW
50
    pub fn new(argument: BlobDigest, result: BlobDigest) -> Self {
×
51
        Self { argument, result }
52
    }
53
}
54

55
#[derive(Debug, PartialEq, PartialOrd, Hash, Clone, Serialize, Deserialize)]
56
pub struct Interface {
57
    pub methods: BTreeMap<Name, Signature>,
58
}
59

60
impl Interface {
UNCOV
61
    pub fn new(methods: BTreeMap<Name, Signature>) -> Self {
×
62
        Self { methods }
63
    }
64
}
65

66
#[derive(Debug, PartialEq, PartialOrd, Hash, Clone)]
67
pub struct TypedExpression {
68
    pub expression: DeepExpression,
69
    pub type_: Type,
70
}
71

72
impl TypedExpression {
73
    pub fn new(expression: DeepExpression, type_: Type) -> Self {
4✔
74
        Self { expression, type_ }
75
    }
76

UNCOV
77
    pub fn unit() -> Self {
×
NEW
78
        Self::new(DeepExpression(Expression::Unit), Type::Unit)
×
79
    }
80

NEW
81
    pub fn convert_into(self, type_: &Type) -> DeepExpression {
×
UNCOV
82
        if &self.type_ == type_ {
×
UNCOV
83
            self.expression
×
84
        } else {
85
            todo!()
86
        }
87
    }
88
}
89

90
#[derive(Debug, PartialEq, Eq, Ord, PartialOrd, Hash, Clone)]
91
pub enum Type {
92
    Named(Name),
93
    Unit,
94
    Option(BlobDigest),
95
    Function(Box<Signature>),
96
    Reference,
97
}
98

99
impl Type {
NEW
100
    pub fn print(&self, writer: &mut dyn std::fmt::Write) -> std::fmt::Result {
×
UNCOV
101
        match self {
×
UNCOV
102
            Type::Named(name) => write!(writer, "{}", &name.key),
×
103
            Type::Unit => write!(writer, "()"),
×
104
            Type::Option(blob_digest) => write!(writer, "Option<{}>", blob_digest),
×
105
            Type::Function(signature) => {
×
NEW
106
                write!(writer, "{} -> {}", &signature.argument, &signature.result)
×
107
            }
108
            Type::Reference => write!(writer, "Reference"),
×
109
        }
110
    }
111

NEW
112
    pub fn deserialize(_value: &Value, _load_value: &(dyn LoadValue + Sync)) -> Option<Type> {
×
113
        todo!()
114
    }
115

NEW
116
    pub fn to_value(&self) -> Value {
×
117
        todo!()
118
    }
119
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc