pub trait SceneItemExtSceneTrait {
// Required methods
fn add_source<T: ObsSourceTrait + Clone + 'static>(
&mut self,
source: T,
) -> Result<ObsSceneItemRef<T>, ObsError>;
fn add_and_create_source(
&mut self,
info: SourceInfo,
) -> Result<ObsSceneItemRef<ObsSourceRef>, ObsError>;
fn get_source(
&self,
name: &str,
) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>;
fn remove_every_item_of_source<T: ObsSourceTrait>(
&mut self,
source: T,
) -> Result<(), ObsError>;
fn remove_item<K: SceneItemTrait + ?Sized>(
&mut self,
scene_item: &K,
) -> Result<(), ObsError>;
fn remove_all_sources(&mut self) -> Result<(), ObsError>;
fn items_for_source<T: ObsSourceTrait + Clone>(
&self,
source: &T,
) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>;
// Provided methods
fn get_source_mut(
&self,
name: &str,
) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError> { ... }
fn remove_scene_item<K: SceneItemTrait>(
&mut self,
scene_item: K,
) -> Result<(), ObsError> { ... }
fn get_scene_item_ptr<T: ObsSourceTrait + Clone>(
&self,
source: &T,
) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError> { ... }
}Required Methods§
Sourcefn add_source<T: ObsSourceTrait + Clone + 'static>(
&mut self,
source: T,
) -> Result<ObsSceneItemRef<T>, ObsError>
fn add_source<T: ObsSourceTrait + Clone + 'static>( &mut self, source: T, ) -> Result<ObsSceneItemRef<T>, ObsError>
Adds the specified source to this scene. Returns a reference to the created scene item. You can use that SceneItemPtr to manipulate the source within this scene (position, scale, rotation, etc).
Sourcefn add_and_create_source(
&mut self,
info: SourceInfo,
) -> Result<ObsSceneItemRef<ObsSourceRef>, ObsError>
fn add_and_create_source( &mut self, info: SourceInfo, ) -> Result<ObsSceneItemRef<ObsSourceRef>, ObsError>
Creates and adds a source to this scene based on the given SourceInfo.
Returns a reference to the created scene item, which internally holds the created source.
Sourcefn get_source(
&self,
name: &str,
) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>
fn get_source( &self, name: &str, ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>
Gets a source by name from this scene. Returns None if no source with the given name exists in this scene.
Sourcefn remove_every_item_of_source<T: ObsSourceTrait>(
&mut self,
source: T,
) -> Result<(), ObsError>
fn remove_every_item_of_source<T: ObsSourceTrait>( &mut self, source: T, ) -> Result<(), ObsError>
Removes the given source from this scene. Removes the corresponding scene item as well. It may be possible that this source is still added to another scene.
Sourcefn remove_item<K: SceneItemTrait + ?Sized>(
&mut self,
scene_item: &K,
) -> Result<(), ObsError>
fn remove_item<K: SceneItemTrait + ?Sized>( &mut self, scene_item: &K, ) -> Result<(), ObsError>
Removes a specific scene item from this scene immediately.
Sourcefn remove_all_sources(&mut self) -> Result<(), ObsError>
fn remove_all_sources(&mut self) -> Result<(), ObsError>
Removes all sources from this scene.
Sourcefn items_for_source<T: ObsSourceTrait + Clone>(
&self,
source: &T,
) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>
fn items_for_source<T: ObsSourceTrait + Clone>( &self, source: &T, ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>
Gets the underlying scene item pointers for the given source in this scene.
A scene item is basically the representation of a source within this scene. It holds information about the position, scale, rotation, etc.
Provided Methods§
fn get_source_mut( &self, name: &str, ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>
Use get_source; the returned shared handle was never a mutable reference
fn remove_scene_item<K: SceneItemTrait>( &mut self, scene_item: K, ) -> Result<(), ObsError>
Use remove_item; it removes the native scene item immediately without consuming the handle
fn get_scene_item_ptr<T: ObsSourceTrait + Clone>( &self, source: &T, ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>
Use items_for_source; scene item handles are managed objects, not raw pointers
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".