pub struct SystemProfile {
pub buses: Vec<Bus>,
}Expand description
Root JSON returned from system_profiler and used as holder for all static USB bus data
Fields§
§buses: Vec<Bus>system buses
Implementations§
Source§impl SystemProfile
impl SystemProfile
Sourcepub fn into_flattened(&mut self)
pub fn into_flattened(&mut self)
Flattens all Buses by calling into_flattened_devices on each
In place operation so it mutates the data and tree structure is lost. Location data is still present in each device.
Sourcepub fn flattened_devices(&self) -> Vec<&Device>
pub fn flattened_devices(&self) -> Vec<&Device>
Returns a flattened Vec of references to all Devices in each of the buses
Sourcepub fn get_bus(&self, number: u8) -> Option<&Bus>
pub fn get_bus(&self, number: u8) -> Option<&Bus>
Returns reference to Bus number if it exists in data
Sourcepub fn get_bus_mut(&mut self, number: u8) -> Option<&mut Bus>
pub fn get_bus_mut(&mut self, number: u8) -> Option<&mut Bus>
Returns mutable reference to Bus number if it exists in data
Sourcepub fn get_node_mut(&mut self, port_path: &PortPath) -> Option<&mut Device>
pub fn get_node_mut(&mut self, port_path: &PortPath) -> Option<&mut Device>
Sourcepub fn get_node_by_path<P: AsRef<Path>>(&self, path: P) -> Option<&Device>
pub fn get_node_by_path<P: AsRef<Path>>(&self, path: P) -> Option<&Device>
Search for reference to Device at port_path as Path
Sourcepub fn get_node_path_by_path_mut<P: AsRef<Path>>(
&mut self,
path: P,
) -> Option<&mut Device>
pub fn get_node_path_by_path_mut<P: AsRef<Path>>( &mut self, path: P, ) -> Option<&mut Device>
Search for mutable reference to Device at port_path as Path
Sourcepub fn get_node_by_str(&self, path: &str) -> Option<&Device>
pub fn get_node_by_str(&self, path: &str) -> Option<&Device>
Search for reference to Device at port path as string
Sourcepub fn get_node_str_mut(&mut self, path: &str) -> Option<&mut Device>
pub fn get_node_str_mut(&mut self, path: &str) -> Option<&mut Device>
Search for mutable reference to Device at port path as string
Sourcepub fn get_config(
&self,
port_path: &PortPath,
config: u8,
) -> Option<&Configuration>
pub fn get_config( &self, port_path: &PortPath, config: u8, ) -> Option<&Configuration>
Get reference to Configuration at port_path and config if present
Sourcepub fn get_config_mut(
&mut self,
port_path: &PortPath,
config: u8,
) -> Option<&mut Configuration>
pub fn get_config_mut( &mut self, port_path: &PortPath, config: u8, ) -> Option<&mut Configuration>
Get mutable reference to Configuration at PortPath and config if present
Sourcepub fn get_interface(&self, device_path: &DevicePath) -> Option<&Interface>
pub fn get_interface(&self, device_path: &DevicePath) -> Option<&Interface>
Get reference to Interface at port_path, config and interface if present in DevicePath
Sourcepub fn get_interface_mut(
&mut self,
device_path: &DevicePath,
) -> Option<&mut Interface>
pub fn get_interface_mut( &mut self, device_path: &DevicePath, ) -> Option<&mut Interface>
Get mutable reference to Interface at port_path, config and interface if present in DevicePath
Sourcepub fn get_endpoint(&self, endpoint_path: &EndpointPath) -> Option<&Endpoint>
pub fn get_endpoint(&self, endpoint_path: &EndpointPath) -> Option<&Endpoint>
Get reference to Endpoint at port_path, config, interface and endpoint if present
Sourcepub fn get_endpoint_mut(
&mut self,
endpoint_path: &EndpointPath,
) -> Option<&mut Endpoint>
pub fn get_endpoint_mut( &mut self, endpoint_path: &EndpointPath, ) -> Option<&mut Endpoint>
Get mutable reference to Endpoint at port_path, config, interface and endpoint if present
Sourcepub fn get_id(&self, id: &DeviceId) -> Option<&Device>
pub fn get_id(&self, id: &DeviceId) -> Option<&Device>
Search for ::nusb::DeviceId in branches of bus and return reference
Sourcepub fn get_id_mut(&mut self, id: &DeviceId) -> Option<&mut Device>
pub fn get_id_mut(&mut self, id: &DeviceId) -> Option<&mut Device>
Search for ::nusb::DeviceId in branches of bus and returns a mutable reference if found
Trait Implementations§
Source§impl Debug for SystemProfile
impl Debug for SystemProfile
Source§impl<'de> Deserialize<'de> for SystemProfile
impl<'de> Deserialize<'de> for SystemProfile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SystemProfile
impl Display for SystemProfile
Source§impl<'a> IntoIterator for &'a SystemProfile
impl<'a> IntoIterator for &'a SystemProfile
Auto Trait Implementations§
impl Freeze for SystemProfile
impl RefUnwindSafe for SystemProfile
impl Send for SystemProfile
impl Sync for SystemProfile
impl Unpin for SystemProfile
impl UnsafeUnpin for SystemProfile
impl UnwindSafe for SystemProfile
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more