Skip to main content

FindInstance

Struct FindInstance 

Source
pub struct FindInstance { /* private fields */ }

Implementations§

Source§

impl FindInstance

Source

pub fn create( settings: Option<&NDIlib_find_create_t>, ) -> NDIResult<FindInstance>

Examples found in repository?
examples/cycling-router.rs (line 6)
5fn main() {
6    let mut fi = FindInstance::create(None).unwrap();
7    let my_name = "Source Scanning Router";
8    let ri = RouteInstance::create(my_name, &vec!["Public"]).unwrap();
9
10    loop {
11        fi.wait_for_sources(1000).unwrap();
12        let some_sources: Vec<Source> = fi.get_current_sources().unwrap();
13        println!("Found {} sources", some_sources.len());
14        for source in some_sources {
15            let is_me =
16                source.ndi_name.contains(my_name) && source.url_address.starts_with("127.0.0.1");
17            if !is_me {
18                let source = source.clone();
19                println!("Name: {}\nURL: {}\n", source.ndi_name, source.url_address);
20                ri.change(&source).unwrap();
21                sleep(Duration::from_secs(5));
22            }
23        }
24    }
25}
Source

pub fn get_current_sources(&mut self) -> NDIResult<Vec<Source>>

Examples found in repository?
examples/cycling-router.rs (line 12)
5fn main() {
6    let mut fi = FindInstance::create(None).unwrap();
7    let my_name = "Source Scanning Router";
8    let ri = RouteInstance::create(my_name, &vec!["Public"]).unwrap();
9
10    loop {
11        fi.wait_for_sources(1000).unwrap();
12        let some_sources: Vec<Source> = fi.get_current_sources().unwrap();
13        println!("Found {} sources", some_sources.len());
14        for source in some_sources {
15            let is_me =
16                source.ndi_name.contains(my_name) && source.url_address.starts_with("127.0.0.1");
17            if !is_me {
18                let source = source.clone();
19                println!("Name: {}\nURL: {}\n", source.ndi_name, source.url_address);
20                ri.change(&source).unwrap();
21                sleep(Duration::from_secs(5));
22            }
23        }
24    }
25}
Source

pub fn wait_for_sources(&mut self, timeout_ms: u32) -> NDIResult<bool>

Examples found in repository?
examples/cycling-router.rs (line 11)
5fn main() {
6    let mut fi = FindInstance::create(None).unwrap();
7    let my_name = "Source Scanning Router";
8    let ri = RouteInstance::create(my_name, &vec!["Public"]).unwrap();
9
10    loop {
11        fi.wait_for_sources(1000).unwrap();
12        let some_sources: Vec<Source> = fi.get_current_sources().unwrap();
13        println!("Found {} sources", some_sources.len());
14        for source in some_sources {
15            let is_me =
16                source.ndi_name.contains(my_name) && source.url_address.starts_with("127.0.0.1");
17            if !is_me {
18                let source = source.clone();
19                println!("Name: {}\nURL: {}\n", source.ndi_name, source.url_address);
20                ri.change(&source).unwrap();
21                sleep(Duration::from_secs(5));
22            }
23        }
24    }
25}

Trait Implementations§

Source§

impl Drop for FindInstance

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for FindInstance

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.