Skip to main content

parse_device_name

Function parse_device_name 

Source
pub(crate) fn parse_device_name(
    dev_obj: &Bound<'_, PyAny>,
) -> PyResult<Option<String>>
Expand description

Normalize a Python device_name (str | bytes | None) into Option<String>, mapping both None and the empty string to None (meaning the system default). Shared by the capture and playback settings extractors.

An interior NUL is rejected here with ValueError: the name becomes a C string for libpulse on the worker thread, where it could only surface as a panic.