pub struct AlsaPcmName { /* private fields */ }Expand description
Parsed ALSA PCM name accepted by this adapter.
Implementations§
Source§impl AlsaPcmName
impl AlsaPcmName
Sourcepub fn parse(raw: impl Into<String>) -> Result<Self>
pub fn parse(raw: impl Into<String>) -> Result<Self>
Parses an ALSA PCM name, accepting default, hw:*, and plughw:*.
The hw:* and plughw:* tails must be non-empty and whitespace-free.
Any other name is rejected with an Error::Eval.
§Examples
use sim_lib_stream_alsa::{AlsaPcmName, AlsaPcmNameKind};
let name = AlsaPcmName::parse("plughw:1,0").unwrap();
assert_eq!(name.kind(), AlsaPcmNameKind::PlugHw);
assert_eq!(name.raw(), "plughw:1,0");
assert!(!name.is_default());
assert!(AlsaPcmName::parse("oss:0").is_err());Sourcepub fn kind(&self) -> AlsaPcmNameKind
pub fn kind(&self) -> AlsaPcmNameKind
Returns the parsed name family.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true when this is the ALSA default PCM.
Sourcepub fn device_symbol(&self, direction: HostDirection) -> Symbol
pub fn device_symbol(&self, direction: HostDirection) -> Symbol
Builds the SIM device Symbol for this PCM name in the given
direction, of the form alsa/<raw>/<role> where the role suffix is
capture, playback, or duplex.
Trait Implementations§
Source§impl Clone for AlsaPcmName
impl Clone for AlsaPcmName
Source§fn clone(&self) -> AlsaPcmName
fn clone(&self) -> AlsaPcmName
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 AlsaPcmName
impl Debug for AlsaPcmName
impl Eq for AlsaPcmName
Source§impl PartialEq for AlsaPcmName
impl PartialEq for AlsaPcmName
Source§fn eq(&self, other: &AlsaPcmName) -> bool
fn eq(&self, other: &AlsaPcmName) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AlsaPcmName
Auto Trait Implementations§
impl Freeze for AlsaPcmName
impl RefUnwindSafe for AlsaPcmName
impl Send for AlsaPcmName
impl Sync for AlsaPcmName
impl Unpin for AlsaPcmName
impl UnsafeUnpin for AlsaPcmName
impl UnwindSafe for AlsaPcmName
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