pub enum SourceAddress {
None,
Url(String),
Ip(String),
}Expand description
Network address of an NDI source.
NDI sources can be addressed via URL (for NDI HX sources) or IP address (for standard NDI sources).
Variants§
None
No address available.
Url(String)
URL address (typically for NDI HX sources).
Ip(String)
IP address (for standard NDI sources).
Implementations§
Source§impl SourceAddress
impl SourceAddress
Sourcepub fn contains_host(&self, host: &str) -> bool
pub fn contains_host(&self, host: &str) -> bool
Check whether this address has the exact host or IP.
Hostnames compare without ASCII case or a final DNS dot. Invalid bare-host queries return false.
§Arguments
host- The hostname or IP address to search for
§Examples
use grafton_ndi::SourceAddress;
let addr = SourceAddress::Ip("192.168.1.100:5960".to_string());
assert!(addr.contains_host("192.168.1.100"));
assert!(!addr.contains_host("192.168.1"));
let url = SourceAddress::Url("http://camera.local:8080".to_string());
assert!(url.contains_host("camera.local"));Sourcepub fn port(&self) -> Option<u16>
pub fn port(&self) -> Option<u16>
Extract an explicit port from conventional host/port or URL syntax.
SDK address strings are opaque; unrecognized syntax returns None.
Parses the port from addresses in the format host:port.
§Returns
Some(port) if a valid port is found, None otherwise.
§Examples
use grafton_ndi::SourceAddress;
let addr = SourceAddress::Ip("192.168.1.100:5960".to_string());
assert_eq!(addr.port(), Some(5960));
let no_port = SourceAddress::Ip("192.168.1.100".to_string());
assert_eq!(no_port.port(), None);
let url = SourceAddress::Url("http://camera.local:8080".to_string());
assert_eq!(url.port(), Some(8080));Trait Implementations§
Source§impl Clone for SourceAddress
impl Clone for SourceAddress
Source§fn clone(&self) -> SourceAddress
fn clone(&self) -> SourceAddress
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SourceAddress
impl Debug for SourceAddress
Source§impl Default for SourceAddress
impl Default for SourceAddress
Source§fn default() -> SourceAddress
fn default() -> SourceAddress
Returns the “default value” for a type. Read more
impl Eq for SourceAddress
Source§impl Hash for SourceAddress
impl Hash for SourceAddress
Source§impl PartialEq for SourceAddress
impl PartialEq for SourceAddress
impl StructuralPartialEq for SourceAddress
Auto Trait Implementations§
impl Freeze for SourceAddress
impl RefUnwindSafe for SourceAddress
impl Send for SourceAddress
impl Sync for SourceAddress
impl Unpin for SourceAddress
impl UnsafeUnpin for SourceAddress
impl UnwindSafe for SourceAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more