libobs_wrapper\sources/
builder.rs

1use crate::{
2    data::ObsObjectBuilder,
3    scenes::ObsSceneRef,
4    utils::ObsError,
5};
6
7use super::ObsSourceRef;
8
9#[cfg_attr(not(feature="blocking"), async_trait::async_trait)]
10pub trait ObsSourceBuilder: ObsObjectBuilder {
11    #[cfg_attr(feature = "blocking", remove_async_await::remove_async_await)]
12    async fn add_to_scene<'a>(self, scene: &'a mut ObsSceneRef) -> Result<ObsSourceRef, ObsError>
13    where
14        Self: Sized,
15    {
16        let s = self.build().await?;
17        scene.add_source(s).await
18    }
19}