Skip to main content

Devices

Struct Devices 

Source
#[non_exhaustive]
pub struct Devices {
Show 22 fields pub kvm: PathBuf, pub etc_group: PathBuf, pub proc_modules: PathBuf, pub kernel_release: PathBuf, pub lib_modules: PathBuf, pub kvm_virt_at_load: PathBuf, pub sys_module: PathBuf, pub modprobe_d: PathBuf, pub applications: PathBuf, pub docker_desktop_socket: PathBuf, pub docker_desktop_settings: Vec<PathBuf>, pub utm_app: PathBuf, pub hyperv_service: PathBuf, pub vmware_utility: PathBuf, pub vmware_utility_service: SocketAddr, pub vmrun: Vec<PathBuf>, pub prlctl: Vec<PathBuf>, pub vhost_user: Vec<PathBuf>, pub virtiofsd: Vec<PathBuf>, pub netstat: Vec<PathBuf>, pub ovftool: Vec<PathBuf>, pub rosetta_runtime: PathBuf,
}
Expand description

The files and the one local service detection reads instead of running a tool: each a path a test points into a folder of its own (Devices::under), so no test reads the machine running it.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§kvm: PathBuf

KVM’s device (/dev/kvm), which libvirt’s and QEMU’s guests run on (Linux).

§etc_group: PathBuf

The group database (/etc/group): the name of the group /dev/kvm belongs to.

§proc_modules: PathBuf

The kernel modules loaded (/proc/modules): VirtualBox’s driver, KVM’s CPU module.

§kernel_release: PathBuf

The running kernel’s release (/proc/sys/kernel/osrelease, what uname -r says).

§lib_modules: PathBuf

The kernels’ module folders (/lib/modules), each with a build link once its headers are installed.

§kvm_virt_at_load: PathBuf

KVM’s enable_virt_at_load parameter (/sys/module/kvm/parameters/enable_virt_at_load, Linux 6.12 and later).

§sys_module: PathBuf

The loaded modules’ folders (/sys/module): each loadable module’s refcnt (how many hold it) and holders (the modules among them).

§modprobe_d: PathBuf

The folder of the options modprobe gives a module as it loads it (/etc/modprobe.d, its *.conf files).

§applications: PathBuf

The Applications folder macOS apps install into (/Applications): a tool’s app bundle (crate::install::ToolRow::mac_app) is looked for there, and Docker Desktop’s own docker CLI inside its bundle.

§docker_desktop_socket: PathBuf

Docker Desktop’s socket (~/.docker/run/docker.sock, macOS), which listens once its backend runs: never, while Docker Desktop waits for its user in its own window.

§docker_desktop_settings: Vec<PathBuf>

Docker Desktop’s settings files, the first there read: settings-store.json, then the settings.json of a Docker Desktop before 4.34 (~/Library/Group Containers/ group.com.docker on macOS, %APPDATA%\Docker on Windows, ~/.docker/desktop on Linux). They record the version of the agreement its user accepted in its window (crate::docker::agreement_accepted).

§utm_app: PathBuf

UTM’s app bundle (macOS): in /Applications, else in the user’s own ~/Applications (an install without an administrator’s password); /Applications/UTM.app when in neither.

§hyperv_service: PathBuf

Hyper-V’s Virtual Machine Management service (%SystemRoot%\System32\vmms.exe), there once the Windows feature is on.

§vmware_utility: PathBuf

What proves HashiCorp’s Vagrant VMware Utility is installed: its program on macOS and Linux, the certificates its installer generates (under %ProgramData%) on Windows.

§vmware_utility_service: SocketAddr

Where the Vagrant VMware Utility’s service answers when it runs: this machine’s port 9922, the plugin’s default (utility_port).

§vmrun: Vec<PathBuf>

Where VMware’s apps install vmrun, looked at when it isn’t on PATH: Fusion’s Contents/Public/vmrun in /Applications, then in ~/Applications (macOS); Workstation’s folder under %ProgramFiles(x86)%, then %ProgramFiles% (Windows).

§prlctl: Vec<PathBuf>

Where Parallels Desktop installs prlctl, looked at when it isn’t on PATH: the app’s Contents/MacOS/prlctl in /Applications, then in ~/Applications.

§vhost_user: Vec<PathBuf>

The folders libvirt reads QEMU’s vhost-user descriptors from, in its order, a later folder’s file taking the place of an earlier one’s of the same name: the distribution’s (/usr/share/qemu/vhost-user), then an administrator’s (/etc/qemu/vhost-user) (Linux).

§virtiofsd: Vec<PathBuf>

Where vagrant-qemu looks for the virtiofsd it shares folders through, in its order: virtiofsd in each folder of PATH, then /usr/libexec/virtiofsd, then /usr/lib/qemu/virtiofsd (Linux).

§netstat: Vec<PathBuf>

Where vagrant-vmware-desktop looks for the netstat it reads the routing table with before it makes a private network (its collision check): netstat in each folder of PATH (Linux; macOS has it in /usr/sbin, Windows reads its routes otherwise).

§ovftool: Vec<PathBuf>

Where VMware’s hypervisors keep their own OVF Tool (ovftool), in the order to look: Fusion’s Contents/Library/VMware OVF Tool in /Applications, then in ~/Applications (macOS); Workstation’s OVFTool folder under %ProgramFiles(x86)%, then %ProgramFiles% (Windows). Workstation for Linux puts it in /usr/bin, on PATH.

§rosetta_runtime: PathBuf

Rosetta 2’s runtime (/Library/Apple/usr/libexec/oah/libRosettaRuntime), there once it is installed (macOS on Apple silicon).

Implementations§

Source§

impl Devices

Source

pub fn here(os: HostOs) -> Devices

This computer’s, on os: where each OS keeps them.

Source

pub fn under(root: &Path) -> Devices

Each one under the folder root, where a test makes the ones it is about (root/dev/kvm, root/proc/modules, root/Applications/UTM.app…), none of which exist until it does; the VMware Utility’s service at port 0 of this machine, which nothing answers. The apps’ tools (the hypervisors’ OVF Tools too) are under root and root/home (macOS’s), and root/Program Files (x86) and root/Program Files (Workstation’s); Rosetta’s runtime under root; libvirt’s descriptor folders and vagrant-qemu’s virtiofsd fallbacks under root, with no PATH folder before them; netstat as root/usr/bin/netstat.

Source§

impl Devices

Source

pub fn app_tool(&self, program: &str) -> Vec<&Path>

Where an app installs program off PATH (Devices::vmrun, Devices::prlctl), in the order to look; none for a tool no app here installs.

Trait Implementations§

Source§

impl Clone for Devices

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Devices

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Devices

Source§

impl PartialEq for Devices

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Devices

Auto Trait Implementations§

§

impl Forget for Devices

§

impl Freeze for Devices

§

impl Move for Devices

§

impl RefUnwindSafe for Devices

§

impl Send for Devices
where RawVecInner: Send,

§

impl Sync for Devices
where RawVecInner: Sync,

§

impl Unpin for Devices
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Devices

§

impl UnwindSafe for Devices
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more