Struct vapoursynth::api::API
source · [−]pub struct API { /* private fields */ }
Expand description
A wrapper for the VapourSynth API.
Implementations
sourceimpl API
impl API
sourcepub fn get() -> Option<Self>
pub fn get() -> Option<Self>
Retrieves the VapourSynth API.
Returns None
on error, for example if the requested API version (selected with features,
see the crate-level docs) is not supported.
sourcepub fn log(
self,
message_type: MessageType,
message: &str
) -> Result<(), NulError>
pub fn log(
self,
message_type: MessageType,
message: &str
) -> Result<(), NulError>
Sends a message through VapourSynth’s logging framework.
sourcepub fn set_message_handler<F>(self, callback: F) where
F: FnMut(MessageType, &CStr) + Send + 'static,
👎 Deprecated: use add_message_handler
and remove_message_handler
instead
pub fn set_message_handler<F>(self, callback: F) where
F: FnMut(MessageType, &CStr) + Send + 'static,
use add_message_handler
and remove_message_handler
instead
Installs a custom handler for the various error messages VapourSynth emits. The message handler is currently global, i.e. per process, not per VSCore instance.
The default message handler simply sends the messages to the standard error stream.
The callback arguments are the message type and the message itself. If the callback panics, the process is aborted.
This function allocates to store the callback, this memory is leaked if the message handler is subsequently changed.
sourcepub fn add_message_handler<F>(self, callback: F) -> MessageHandlerId where
F: FnMut(MessageType, &CStr) + Send + 'static,
pub fn add_message_handler<F>(self, callback: F) -> MessageHandlerId where
F: FnMut(MessageType, &CStr) + Send + 'static,
Installs a custom handler for the various error messages VapourSynth emits. The message handler is currently global, i.e. per process, not per VSCore instance.
The unique ID for the handler is returned, which can be used to remove it using
remove_message_handler
.
If no error handler is installed the messages are sent to the standard error stream.
The callback arguments are the message type and the message itself. If the callback panics, the process is aborted.
sourcepub fn set_message_handler_trivial(self, callback: fn(_: MessageType, _: &CStr))
👎 Deprecated: use add_message_handler_trivial
and remove_message_handler
instead
pub fn set_message_handler_trivial(self, callback: fn(_: MessageType, _: &CStr))
use add_message_handler_trivial
and remove_message_handler
instead
Installs a custom handler for the various error messages VapourSynth emits. The message handler is currently global, i.e. per process, not per VSCore instance.
The default message handler simply sends the messages to the standard error stream.
The callback arguments are the message type and the message itself. If the callback panics, the process is aborted.
This version does not allocate at the cost of accepting a function pointer rather than an arbitrary closure. It can, however, be used with simple closures.
sourcepub fn add_message_handler_trivial(
self,
callback: fn(_: MessageType, _: &CStr)
) -> MessageHandlerId
pub fn add_message_handler_trivial(
self,
callback: fn(_: MessageType, _: &CStr)
) -> MessageHandlerId
Installs a custom handler for the various error messages VapourSynth emits. The message handler is currently global, i.e. per process, not per VSCore instance.
The unique ID for the handler is returned, which can be used to remove it using
remove_message_handler
.
If no error handler is installed the messages are sent to the standard error stream.
The callback arguments are the message type and the message itself. If the callback panics, the process is aborted.
This version does not allocate at the cost of accepting a function pointer rather than an arbitrary closure. It can, however, be used with simple closures.
sourcepub fn clear_message_handler(self)
👎 Deprecated: use add_message_handler
and remove_message_handler
instead
pub fn clear_message_handler(self)
use add_message_handler
and remove_message_handler
instead
Clears any custom message handler, restoring the default one.
sourcepub fn remove_message_handler(self, handler_id: MessageHandlerId)
pub fn remove_message_handler(self, handler_id: MessageHandlerId)
Clears a custom message handler.
If this is the only custom message handler, this will restore the default one.
sourcepub fn create_core<'core>(self, threads: i32) -> CoreRef<'core>
pub fn create_core<'core>(self, threads: i32) -> CoreRef<'core>
Creates and returns a new core.
Note that there’s currently no safe way of freeing the returned core, and the lifetime is
unbounded, because it can live for an arbitrary long time. You may use the (unsafe)
vapoursynth_sys::VSAPI::freeCore()
after ensuring that all frame requests have completed
and all objects belonging to the core have been released.
Trait Implementations
impl Copy for API
impl Send for API
impl Sync for API
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more