pub struct ObsBootstrapper {}Expand description
A struct for bootstrapping OBS Studio.
This struct provides functionality to download, extract, and set up OBS Studio for use with libobs-rs. It also handles updates to OBS when necessary.
If you want to use this bootstrapper to also install required OBS binaries at runtime, do the following:
- Add a
obs.dllfile to your executable directory. This file will be replaced by the obs installer. Recommended to use is the dll dummy (found here, make sure you use the correct OBS version) and rename it toobs.dll. - Call
ObsBootstrapper::bootstrap()at the start of your application. Options must be configured. For more documentation look at the tauri example app. This will download the latest version of OBS and extract it in the executable directory. - If BootstrapStatus::RestartRequired is returned, you’ll need to restart your application. A updater process has been spawned to watch for the application to exit and rename the
obs_new.dllfile toobs.dll. - Exit the application. The updater process will wait for the application to exit and rename the
obs_new.dllfile toobs.dlland restart your application with the same arguments as before.
Implementations§
Source§impl ObsBootstrapper
A convenience type that exposes high-level helpers to detect, update and
bootstrap an OBS installation.
impl ObsBootstrapper
A convenience type that exposes high-level helpers to detect, update and bootstrap an OBS installation.
The bootstrapper coordinates version checks and the streaming bootstrap process. It does not itself perform low-level network or extraction work; instead it delegates to internal modules (version checking and the bootstrap stream) and surfaces a simple API for callers.
Sourcepub fn is_valid_installation() -> Result<bool, ObsBootstrapError>
pub fn is_valid_installation() -> Result<bool, ObsBootstrapError>
Returns true if a valid OBS installation (as determined by locating the OBS DLL and querying the installed version) is present on the system.
§Returns
Ok(true)if an installed OBS version could be detected.Ok(false)if no installed OBS version was found.
§Errors
Returns an Err(ObsBootstrapError) if there was an error locating the OBS DLL or
reading the installed version information.
Sourcepub fn is_update_available() -> Result<bool, ObsBootstrapError>
pub fn is_update_available() -> Result<bool, ObsBootstrapError>
Returns true when an update to OBS should be performed.
The function first checks whether OBS is installed. If no installation
is found it treats that as an available update (returns Ok(true)).
Otherwise it consults the internal version logic to determine whether
the installed version should be updated.
§Returns
Ok(true)when an update is recommended or when OBS is not installed.Ok(false)when the installed version is up-to-date.
§Errors
Returns an Err(ObsBootstrapError) if there was an error locating the OBS DLL or
determining the currently installed version or update necessity.
Sourcepub async fn bootstrap(
options: &ObsBootstrapperOptions,
) -> Result<ObsBootstrapperResult, ObsBootstrapError>
pub async fn bootstrap( options: &ObsBootstrapperOptions, ) -> Result<ObsBootstrapperResult, ObsBootstrapError>
Bootstraps OBS using the provided options and a default console status handler.
This is a convenience wrapper around bootstrap_with_handler that
supplies an ObsBootstrapConsoleHandler as the status consumer.
§Returns
Ok(ObsBootstrapperResult::None)if no action was necessary.Ok(ObsBootstrapperResult::Restart)if the bootstrap completed and a restart is required.
§Errors
Returns Err(ObsBootstrapError) for any failure that prevents the
bootstrap from completing (download failures, extraction failures,
general errors).
Sourcepub async fn bootstrap_with_handler<E: Send + Sync + 'static + Error>(
options: &ObsBootstrapperOptions,
handler: Box<dyn ObsBootstrapStatusHandler<Error = E>>,
) -> Result<ObsBootstrapperResult, ObsBootstrapError>
pub async fn bootstrap_with_handler<E: Send + Sync + 'static + Error>( options: &ObsBootstrapperOptions, handler: Box<dyn ObsBootstrapStatusHandler<Error = E>>, ) -> Result<ObsBootstrapperResult, ObsBootstrapError>
Bootstraps OBS using the provided options and a custom status handler.
The handler will receive progress updates as the bootstrap stream emits statuses. The method drives the bootstrap stream to completion and maps stream statuses into handler calls or final results:
BootstrapStatus::Downloading(progress, message)→ callshandler.handle_downloading(progress, message). Handler errors are mapped toObsBootstrapError::DownloadError.BootstrapStatus::Extracting(progress, message)→ callshandler.handle_extraction(progress, message). Handler errors are mapped toObsBootstrapError::ExtractError.BootstrapStatus::Error(err)→ returnsErr(ObsBootstrapError::GeneralError(_)).BootstrapStatus::RestartRequired→ returnsOk(ObsBootstrapperResult::Restart).
If the underlying bootstrap(options) call returns None there is
nothing to do and the function returns Ok(ObsBootstrapperResult::None).
§Parameters
options: configuration that controls download/extraction behavior.handler: user-provided boxed trait object that receives progress notifications; it is called on each progress update and can fail.
§Returns
Ok(ObsBootstrapperResult::None)when no work was required or the stream completed without requiring a restart.Ok(ObsBootstrapperResult::Restart)when the bootstrap succeeded and a restart is required.
§Errors
Returns Err(ObsBootstrapError) when:
- the bootstrap pipeline could not be started,
- the handler returns an error while handling a download or extraction
update (mapped respectively to
DownloadError/ExtractError), - or when the bootstrap stream yields a general error.