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

vortex-data / vortex / 16935267080

13 Aug 2025 11:00AM UTC coverage: 24.312% (-63.3%) from 87.658%
16935267080

Pull #4226

github

web-flow
Merge 81b48c7fb into baa6ea202
Pull Request #4226: Support converting TimestampTZ to and from duckdb

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

20666 existing lines in 469 files now uncovered.

8726 of 35892 relevant lines covered (24.31%)

147.74 hits per line

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

0.0
/vortex-ffi/src/string.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::ffi::{CStr, c_char};
5
use std::slice;
6

7
use vortex::error::{VortexExpect, vortex_err};
8

9
use crate::arc_dyn_wrapper;
10

11
arc_dyn_wrapper!(
12
    /// Strings for use within Vortex.
13
    str,
14
    vx_string
15
);
16

17
impl vx_string {
18
    #[allow(dead_code)]
UNCOV
19
    pub(crate) fn as_str<'a>(ptr: *const vx_string) -> &'a str {
×
20
        unsafe {
UNCOV
21
            str::from_utf8_unchecked(slice::from_raw_parts(
×
UNCOV
22
                vx_string_ptr(ptr).cast(),
×
UNCOV
23
                vx_string_len(ptr),
×
UNCOV
24
            ))
×
25
        }
UNCOV
26
    }
×
27
}
28

29
/// Create a new Vortex UTF-8 string by copying from a pointer and length.
30
#[unsafe(no_mangle)]
31
pub unsafe extern "C-unwind" fn vx_string_new(ptr: *const c_char, len: usize) -> *const vx_string {
×
32
    let slice = unsafe { slice::from_raw_parts(ptr.cast(), len) };
×
33
    let string = String::from_utf8(slice.to_vec())
×
34
        .map_err(|e| vortex_err!("Invalid UTF-8 string {e}"))
×
35
        .vortex_expect("Invalid UTF-8 string");
×
36
    vx_string::new(string.into())
×
37
}
×
38

39
/// Create a new Vortex UTF-8 string by copying from a null-terminated C-style string.
40
#[unsafe(no_mangle)]
41
pub unsafe extern "C-unwind" fn vx_string_new_from_cstr(ptr: *const c_char) -> *const vx_string {
×
42
    let string = unsafe { CStr::from_ptr(ptr) }
×
43
        .to_str()
×
44
        .vortex_expect("Invalid UTF-8 string");
×
45
    vx_string::new(string.into())
×
46
}
×
47

48
/// Return the length of the string in bytes.
49
#[unsafe(no_mangle)]
UNCOV
50
pub unsafe extern "C-unwind" fn vx_string_len(ptr: *const vx_string) -> usize {
×
UNCOV
51
    vx_string::as_ref(ptr).len()
×
UNCOV
52
}
×
53

54
/// Return the pointer to the string data.
55
#[unsafe(no_mangle)]
UNCOV
56
pub unsafe extern "C-unwind" fn vx_string_ptr(ptr: *const vx_string) -> *const c_char {
×
UNCOV
57
    vx_string::as_ref(ptr).as_ptr().cast()
×
UNCOV
58
}
×
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