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

Chik-Network / chik_rs / 14565525798

21 Apr 2025 01:39AM UTC coverage: 67.072% (-17.5%) from 84.616%
14565525798

push

github

Chik-Network
update 0.22.0

2 of 2 new or added lines in 1 file covered. (100.0%)

2902 existing lines in 63 files now uncovered.

11097 of 16545 relevant lines covered (67.07%)

799466.45 hits per line

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

0.0
/crates/chik-protocol/src/lazy_node.rs
1
use klvmr::{allocator::NodePtr, allocator::SExp, Allocator};
2
use pyo3::prelude::*;
3
use pyo3::types::PyBytes;
4
use std::rc::Rc;
5

UNCOV
6
#[pyclass(subclass, unsendable, frozen)]
×
7
#[derive(Clone)]
8
pub struct LazyNode {
9
    allocator: Rc<Allocator>,
10
    node: NodePtr,
11
}
12

13
#[pymethods]
×
14
impl LazyNode {
15
    #[getter(pair)]
UNCOV
16
    pub fn pair(&self, py: Python<'_>) -> PyResult<Option<PyObject>> {
×
UNCOV
17
        match &self.allocator.sexp(self.node) {
×
UNCOV
18
            SExp::Pair(p1, p2) => {
×
UNCOV
19
                let r1 = Self::new(self.allocator.clone(), *p1);
×
UNCOV
20
                let r2 = Self::new(self.allocator.clone(), *p2);
×
UNCOV
21
                let v = (r1, r2).into_pyobject(py)?;
×
UNCOV
22
                Ok(Some(v.into()))
×
23
            }
UNCOV
24
            SExp::Atom => Ok(None),
×
25
        }
UNCOV
26
    }
×
27

28
    #[getter(atom)]
UNCOV
29
    pub fn atom(&self, py: Python<'_>) -> Option<PyObject> {
×
UNCOV
30
        match &self.allocator.sexp(self.node) {
×
UNCOV
31
            SExp::Atom => Some(PyBytes::new(py, self.allocator.atom(self.node).as_ref()).into()),
×
32
            SExp::Pair(..) => None,
×
33
        }
UNCOV
34
    }
×
35
}
36

37
impl LazyNode {
UNCOV
38
    pub const fn new(a: Rc<Allocator>, n: NodePtr) -> Self {
×
UNCOV
39
        Self {
×
UNCOV
40
            allocator: a,
×
UNCOV
41
            node: n,
×
UNCOV
42
        }
×
UNCOV
43
    }
×
44
}
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