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

facet-rs / facet / 15376944042

01 Jun 2025 04:05PM UTC coverage: 58.697% (+0.6%) from 58.142%
15376944042

Pull #700

github

web-flow
Merge 49549753d into 0530f47a7
Pull Request #700: Solve code comment inconsistencies and add missing validations

0 of 2 new or added lines in 2 files covered. (0.0%)

2083 existing lines in 47 files now uncovered.

10306 of 17558 relevant lines covered (58.7%)

128.69 hits per line

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

0.0
/facet-core/src/types/def/function.rs
1
use crate::Shape;
2

3
/// Common fields for function pointer types
4
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5
#[repr(C)]
6
#[non_exhaustive]
7
pub struct FunctionPointerDef {
8
    /// The calling abi of the function pointer
9
    pub abi: FunctionAbi,
10

11
    /// All parameter types, in declaration order
12
    pub parameters: &'static [fn() -> &'static Shape<'static>],
13

14
    /// The return type
15
    pub return_type: fn() -> &'static Shape<'static>,
16
}
17

18
/// The calling ABI of a function pointer
19
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)]
20
#[repr(C)]
21
#[non_exhaustive]
22
pub enum FunctionAbi {
23
    /// C ABI
24
    C,
25

26
    /// Rust ABI
27
    #[default]
28
    Rust,
29

30
    /// An unknown ABI
31
    Unknown,
32
}
33
impl FunctionAbi {
34
    /// Returns the string in `extern "abi-string"` if not [`FunctionAbi::Unknown`].
UNCOV
35
    pub fn as_abi_str(&self) -> Option<&str> {
×
UNCOV
36
        match self {
×
UNCOV
37
            FunctionAbi::C => Some("C"),
×
38
            FunctionAbi::Rust => Some("Rust"),
×
39
            FunctionAbi::Unknown => None,
×
40
        }
UNCOV
41
    }
×
42
}
43

44
impl FunctionPointerDef {
45
    /// Returns a builder for FunctionPointerDef
46
    pub const fn builder() -> FunctionPointerDefBuilder {
×
47
        FunctionPointerDefBuilder::new()
×
48
    }
×
49
}
50

51
/// Builder for FunctionPointerDef
52
pub struct FunctionPointerDefBuilder {
53
    abi: Option<FunctionAbi>,
54
    parameters: &'static [fn() -> &'static Shape<'static>],
55
    return_type: Option<fn() -> &'static Shape<'static>>,
56
}
57

58
impl FunctionPointerDefBuilder {
59
    /// Creates a new FunctionPointerDefBuilder
60
    #[allow(clippy::new_without_default)]
61
    pub const fn new() -> Self {
×
62
        Self {
×
63
            parameters: &[],
×
64
            abi: None,
×
65
            return_type: None,
×
66
        }
×
67
    }
×
68

69
    /// Sets the abi for the FunctionPointerDef
70
    pub const fn abi(mut self, abi: FunctionAbi) -> Self {
×
71
        self.abi = Some(abi);
×
72
        self
×
73
    }
×
74

75
    /// Sets the parameters for the FunctionPointerDef
76
    pub const fn parameter_types(
×
77
        mut self,
×
78
        parameters: &'static [fn() -> &'static Shape<'static>],
×
79
    ) -> Self {
×
80
        self.parameters = parameters;
×
81
        self
×
82
    }
×
83

84
    /// Sets the return type for the FunctionPointerDef
85
    pub const fn return_type(mut self, ty: fn() -> &'static Shape<'static>) -> Self {
×
86
        self.return_type = Some(ty);
×
87
        self
×
88
    }
×
89

90
    /// Builds the FunctionPointerDef
91
    pub const fn build(self) -> FunctionPointerDef {
×
92
        FunctionPointerDef {
×
93
            parameters: self.parameters,
×
94
            return_type: self.return_type.unwrap(),
×
95
            abi: self.abi.unwrap(),
×
96
        }
×
97
    }
×
98
}
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