Skip to main content

PrismBackendVTable

Struct PrismBackendVTable 

Source
#[repr(C)]
pub struct PrismBackendVTable {
Show 28 fields pub size: usize, pub create: Option<unsafe extern "C" fn(userdata: *mut c_void) -> *mut c_void>, pub destroy: Option<unsafe extern "C" fn(instance: *mut c_void)>, pub is_supported: Option<unsafe extern "C" fn(instance: *mut c_void) -> bool>, pub initialize: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>, pub speak: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, interrupt: bool) -> PrismError>, pub speak_to_memory: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, callback: PrismAudioCallback, callback_userdata: *mut c_void) -> PrismError>, pub braille: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char) -> PrismError>, pub output: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, interrupt: bool) -> PrismError>, pub stop: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>, pub pause: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>, pub resume: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>, pub is_speaking: Option<unsafe extern "C" fn(instance: *mut c_void, out_speaking: *mut bool) -> PrismError>, pub set_volume: Option<unsafe extern "C" fn(instance: *mut c_void, volume: f32) -> PrismError>, pub get_volume: Option<unsafe extern "C" fn(instance: *mut c_void, out_volume: *mut f32) -> PrismError>, pub set_rate: Option<unsafe extern "C" fn(instance: *mut c_void, rate: f32) -> PrismError>, pub get_rate: Option<unsafe extern "C" fn(instance: *mut c_void, out_rate: *mut f32) -> PrismError>, pub set_pitch: Option<unsafe extern "C" fn(instance: *mut c_void, pitch: f32) -> PrismError>, pub get_pitch: Option<unsafe extern "C" fn(instance: *mut c_void, out_pitch: *mut f32) -> PrismError>, pub refresh_voices: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>, pub count_voices: Option<unsafe extern "C" fn(instance: *mut c_void, out_count: *mut usize) -> PrismError>, pub get_voice_name: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize, out_name: *mut *const c_char) -> PrismError>, pub get_voice_language: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize, out_language: *mut *const c_char) -> PrismError>, pub set_voice: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize) -> PrismError>, pub get_voice: Option<unsafe extern "C" fn(instance: *mut c_void, out_voice_id: *mut usize) -> PrismError>, pub get_channels: Option<unsafe extern "C" fn(instance: *mut c_void, out_channels: *mut usize) -> PrismError>, pub get_sample_rate: Option<unsafe extern "C" fn(instance: *mut c_void, out_sample_rate: *mut usize) -> PrismError>, pub get_bit_depth: Option<unsafe extern "C" fn(instance: *mut c_void, out_bit_depth: *mut usize) -> PrismError>,
}
Expand description

A table of function pointers implementing a custom backend.

Fields§

§size: usize

The size of this structure as known to the application. This member MUST be set to sizeof(PrismBackendVTable). Prism reads at most size bytes from the structure. If size is smaller than the size of the structure as this version of Prism defines it, the members beyond size are treated as null; if it is larger, the additional bytes are ignored. This scheme permits the structure to grow in later library versions without invalidating applications compiled against earlier ones.

§create: Option<unsafe extern "C" fn(userdata: *mut c_void) -> *mut c_void>

An optional function producing a per-instance state pointer. If non-null, Prism invokes it exactly once for each backend instance constructed from the registration, passing the registration’s userdata, and thereafter passes the returned pointer as the instance argument to every other member invoked for that instance. Should create return NULL, construction of the instance fails. If create is null, the registration’s userdata pointer is passed as the instance argument directly, and all instances of the backend consequently share it.

§destroy: Option<unsafe extern "C" fn(instance: *mut c_void)>

An optional function releasing a state pointer previously returned by create. If both create and destroy are non-null, Prism invokes destroy exactly once for each backend instance, at the time the instance is freed. destroy is never invoked if create is null.

§is_supported: Option<unsafe extern "C" fn(instance: *mut c_void) -> bool>

An optional runtime availability probe. If non-null, Prism invokes it to determine the PRISM_BACKEND_IS_SUPPORTED_AT_RUNTIME bit reported by prism_backend_get_features; if null, the bit declared at registration is reported unchanged. Because prism_backend_get_features MAY be called before initialization, is_supported MAY be invoked before initialize has succeeded, and an implementation of it MUST NOT assume the instance has been initialized. This member designates no operation and is therefore exempt from the feature consistency requirement of prism_registry_builder_add_backend.

§initialize: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>

Implements prism_backend_initialize, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§speak: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, interrupt: bool) -> PrismError>

Implements prism_backend_speak, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§speak_to_memory: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, callback: PrismAudioCallback, callback_userdata: *mut c_void) -> PrismError>

Implements prism_backend_speak_to_memory, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§braille: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char) -> PrismError>

Implements prism_backend_braille, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§output: Option<unsafe extern "C" fn(instance: *mut c_void, text: *const c_char, interrupt: bool) -> PrismError>

Implements prism_backend_output, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§stop: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>

Implements prism_backend_stop, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§pause: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>

Implements prism_backend_pause, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§resume: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>

Implements prism_backend_resume, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§is_speaking: Option<unsafe extern "C" fn(instance: *mut c_void, out_speaking: *mut bool) -> PrismError>

Implements prism_backend_is_speaking, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§set_volume: Option<unsafe extern "C" fn(instance: *mut c_void, volume: f32) -> PrismError>

Implements prism_backend_set_volume, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_volume: Option<unsafe extern "C" fn(instance: *mut c_void, out_volume: *mut f32) -> PrismError>

Implements prism_backend_get_volume, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§set_rate: Option<unsafe extern "C" fn(instance: *mut c_void, rate: f32) -> PrismError>

Implements prism_backend_set_rate, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_rate: Option<unsafe extern "C" fn(instance: *mut c_void, out_rate: *mut f32) -> PrismError>

Implements prism_backend_get_rate, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§set_pitch: Option<unsafe extern "C" fn(instance: *mut c_void, pitch: f32) -> PrismError>

Implements prism_backend_set_pitch, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_pitch: Option<unsafe extern "C" fn(instance: *mut c_void, out_pitch: *mut f32) -> PrismError>

Implements prism_backend_get_pitch, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§refresh_voices: Option<unsafe extern "C" fn(instance: *mut c_void) -> PrismError>

Implements prism_backend_refresh_voices, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§count_voices: Option<unsafe extern "C" fn(instance: *mut c_void, out_count: *mut usize) -> PrismError>

Implements prism_backend_count_voices, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_voice_name: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize, out_name: *mut *const c_char) -> PrismError>

Implements prism_backend_get_voice_name, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_voice_language: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize, out_language: *mut *const c_char) -> PrismError>

Implements prism_backend_get_voice_language, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§set_voice: Option<unsafe extern "C" fn(instance: *mut c_void, voice_id: usize) -> PrismError>

Implements prism_backend_set_voice, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_voice: Option<unsafe extern "C" fn(instance: *mut c_void, out_voice_id: *mut usize) -> PrismError>

Implements prism_backend_get_voice, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_channels: Option<unsafe extern "C" fn(instance: *mut c_void, out_channels: *mut usize) -> PrismError>

Implements prism_backend_get_channels, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_sample_rate: Option<unsafe extern "C" fn(instance: *mut c_void, out_sample_rate: *mut usize) -> PrismError>

Implements prism_backend_get_sample_rate, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

§get_bit_depth: Option<unsafe extern "C" fn(instance: *mut c_void, out_bit_depth: *mut usize) -> PrismError>

Implements prism_backend_get_bit_depth, taking the instance pointer in place of the backend. Null means the operation is unimplemented.

Trait Implementations§

Source§

impl Clone for PrismBackendVTable

Source§

fn clone(&self) -> PrismBackendVTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PrismBackendVTable

Source§

impl Debug for PrismBackendVTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.