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

davidcole1340 / ext-php-rs / 15425631619

03 Jun 2025 07:02PM CUT coverage: 20.885% (-0.04%) from 20.927%
15425631619

Pull #436

github

Xenira
chore(macro)!: change rename defaults to match psr

BREAKING CHANGE: Methods and Properties are renamed to camelCase by default. Classes to PascalCase and constants to UPPER_CASE.

Refs: #189
Pull Request #436: chore(macro)!: change rename defaults to match psr

16 of 35 new or added lines in 5 files covered. (45.71%)

2 existing lines in 2 files now uncovered.

821 of 3931 relevant lines covered (20.89%)

2.31 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