1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::ffi::CString;
use cue_sys as libcue;
pub use cue_sys::PTI;
pub struct CDText {
cdtext: *mut libcue::CdtextPointer,
}
impl CDText {
pub fn from(pointer: *mut libcue::CdtextPointer) -> CDText {
return CDText {
cdtext: pointer,
};
}
pub fn read(&self, pack_type: PTI) -> Option<String> {
let c_string;
unsafe {
let raw_string = libcue::cdtext_get(pack_type, self.cdtext);
if raw_string.is_null() {
return None;
}
c_string = CString::from_raw(raw_string);
}
return Some(c_string.to_string_lossy().into_owned());
}
}