pub struct SourceSpec { /* private fields */ }Expand description
An owned source name or direct URL used by a recorder.
Name and URL constructors are separate because the SDK gives a nonempty name
precedence over a URL. Converting a discovered crate::Source pins its
supplied endpoint, falling back to its name only when no address is present.
Endpoint pinning can become stale; Self::new deliberately selects by name
so the SDK can rediscover an endpoint after it changes. Neither policy silently
falls back to the other after a connection failure. No discovery or SDK call
occurs while constructing this value; constructors allocate one C string.
Implementations§
Source§impl SourceSpec
impl SourceSpec
Sourcepub fn new(name: impl AsRef<str>) -> Result<Self>
pub fn new(name: impl AsRef<str>) -> Result<Self>
Select a source by its NDI name, for example "MACHINE (Camera 1)".
§Errors
Error::InvalidInput when the name is empty, and
Error::InvalidCString when it contains a NUL. For this error,
NulError::into_vec returns the bytes
through the first NUL.
Sourcepub fn from_url(url: impl AsRef<str>) -> Result<Self>
pub fn from_url(url: impl AsRef<str>) -> Result<Self>
Select a source by its address, for example "192.168.1.20:5961",
without discovering it by name.
§Errors
Error::InvalidInput when the address is empty, and
Error::InvalidCString when it contains a NUL.