Untitled Project
inner_line_doc_comments.rs
Source file coverage
Path:
inner_line_doc_comments.rs
Lines:
128
Non-empty lines:
97
Non-empty lines covered with requirements:
97 / 97 (100.0%)
Functions:
20
Functions covered by requirements:
20 / 20 (100.0%)
1
//! Top-level module
2
//! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
3
 
4
#![feature(extern_types, trait_alias)]
5
 
6
pub trait Processor {
7
    type Output;
8
    const MAX_SIZE: usize;
9
 
10
    fn process(&self, input: &str) -> Self::Output;
11
 
12
    fn validate(&self) -> bool {
13
        //! Default method with
14
        //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
15
        //! Description: validation check routine
16
 
17
        true
18
    }
19
}
20
 
21
pub trait ProcessorClone = Processor + Clone;
22
 
23
pub struct Container {
24
    pub name: String,
25
    value: i32,
26
}
27
 
28
impl Processor for Container {
29
    type Output = String;
30
    const MAX_SIZE: usize = 1024;
31
 
32
    fn process(&self, input: &str) -> Self::Output {
33
        //! Impl method with
34
        //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
35
        //! Description: implementation of a process
36
 
37
        format!("{}: {}", self.name, input)
38
    }
39
}
40
 
41
impl Container {
42
    //! Inherent impl with
43
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
44
    //! Text: inherent method block
45
 
46
    pub fn new(name: String) -> Self {
47
        //! Inherent method with
48
        //! @relation(RUST-INNER-LINE-DOC)
49
        //! Words: constructor function pattern
50
 
51
        Self { name, value: 0 }
52
    }
53
 
54
    pub fn get_value(&self) -> i32 {
55
        //! Another method with
56
        //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
57
        //! Random: getter accessor method
58
 
59
        self.value
60
    }
61
}
62
 
63
pub fn process_data(input: &str) -> String {
64
    //! Function with
65
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
66
    //! Description: top-level function utility
67
 
68
    input.to_uppercase()
69
}
70
 
71
pub async fn async_process(data: Vec<u8>) -> Result<(), std::io::Error> {
72
    //! Async function with
73
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
74
    //! Random: asynchronous operation handler
75
 
76
    Ok(())
77
}
78
 
79
pub const fn compute_magic(x: u32) -> u32 {
80
    //! Const function with
81
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
82
    //! Text: compile-time evaluable function
83
 
84
    x * 42
85
}
86
 
87
pub unsafe fn dangerous_operation(ptr: *mut u8) {
88
    //! Unsafe function with
89
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
90
    //! Words: unchecked operation wrapper
91
 
92
    if !ptr.is_null() {
93
        *ptr = 0;
94
    }
95
}
96
 
97
pub mod submodule {
98
    //! Module with
99
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-MOD)
100
    //! Description: nested module container
101
 
102
    pub struct Inner {
103
        data: Vec<u8>,
104
    }
105
}
106
 
107
extern "C" {
108
    //! Foreign function interface with
109
    //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-EXT)
110
    //! Text: external C interface block
111
 
112
    fn external_func(x: i32) -> i32;
113
 
114
    static EXTERNAL_VAR: i32;
115
 
116
    type OpaqueType;
117
}
118
 
119
mod tests {
120
    #[test]
121
    fn test_basic() {
122
        //! Test function with
123
        //! @relation(RUST-INNER-LINE-DOC, RUST-INNER-DOC-POS-FN)
124
        //! Random: unit test case definition
125
 
126
        assert_eq!(2 + 2, 4);
127
    }
128
}