gphoto2 0.1.1

Rust bindings for libgphoto2
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::{borrow::Cow, ffi, mem::MaybeUninit};

pub fn chars_to_cow<'a>(chars: *const i8) -> Cow<'a, str> {
  unsafe { String::from_utf8_lossy(ffi::CStr::from_ptr(chars).to_bytes()) }
}

pub fn camera_text_to_str<'a>(text: libgphoto2_sys::CameraText) -> Cow<'a, str> {
  unsafe { String::from_utf8_lossy(ffi::CStr::from_ptr(text.text.as_ptr()).to_bytes()) }
}

#[inline]
pub unsafe fn uninit<T>() -> T {
  MaybeUninit::zeroed().assume_init()
}