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