pub struct CPointerWrap<T> { /* private fields */ }Expand description
Holds the pointer generated by the Voicevox core and performs memory management through RAII.
Implementations§
Source§impl<T> CPointerWrap<T>
impl<T> CPointerWrap<T>
pub fn new(bytes: *mut T, length: usize, free_fn: fn(*mut T)) -> Self
Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Examples found in repository?
examples/simple-tts.rs (line 15)
4fn main() -> Result<(), vvcore::ResultCode> {
5 println!("VOICEVOX CORE version: {}", VoicevoxCore::get_version());
6
7 let dir = std::ffi::CString::new("open_jtalk_dic_utf_8-1.11").unwrap();
8 let vvc = VoicevoxCore::new_from_options(AccelerationMode::Auto, 0, true, dir.as_c_str())?;
9
10 let text: &str = "こんにちは";
11 let speaker: u32 = 1;
12 let wav = vvc.tts_simple(text, speaker)?;
13
14 let mut file = std::fs::File::create("audio.wav").unwrap();
15 file.write_all(&wav.as_slice()).unwrap();
16
17 Ok(())
18}Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CPointerWrap<T>
impl<T> RefUnwindSafe for CPointerWrap<T>where
T: RefUnwindSafe,
impl<T> !Send for CPointerWrap<T>
impl<T> !Sync for CPointerWrap<T>
impl<T> Unpin for CPointerWrap<T>
impl<T> UnwindSafe for CPointerWrap<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more