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

davidcole1340 / ext-php-rs / 14285961536

05 Apr 2025 09:28PM CUT coverage: 13.062%. Remained the same
14285961536

Pull #417

github

Xenira
docs(coverage): add coverage badge
Pull Request #417: ci(coverage): ignore release pr

520 of 3981 relevant lines covered (13.06%)

1.23 hits per line

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

0.0
/crates/cli/src/ext.rs
1
use std::path::PathBuf;
2

3
use anyhow::{Context, Result};
4
use ext_php_rs::describe::Description;
5
use libloading::os::unix::{Library, Symbol};
6

7
#[allow(improper_ctypes_definitions)]
8
pub struct Ext {
9
    // These need to be here to keep the libraries alive. The extension library needs to be alive
10
    // to access the describe function. Missing here is the lifetime on `Symbol<'a, fn() ->
11
    // Module>` where `ext_lib: 'a`.
12
    #[allow(dead_code)]
13
    ext_lib: Library,
14
    describe_fn: Symbol<extern "C" fn() -> Description>,
15
}
16

17
impl Ext {
18
    /// Loads an extension.
19
    pub fn load(ext_path: PathBuf) -> Result<Self> {
×
20
        let ext_lib = unsafe { Library::new(ext_path) }
×
21
            .with_context(|| "Failed to load extension library")?;
×
22

23
        let describe_fn = unsafe {
24
            ext_lib
×
25
                .get(b"ext_php_rs_describe_module")
26
                .with_context(|| "Failed to load describe function symbol from extension library")?
×
27
        };
28

29
        Ok(Self {
×
30
            ext_lib,
×
31
            describe_fn,
×
32
        })
33
    }
34

35
    /// Describes the extension.
36
    pub fn describe(&self) -> Description {
×
37
        (self.describe_fn)()
×
38
    }
39
}
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

© 2025 Coveralls, Inc