pub struct MlxDeviceHandle(/* private fields */);Expand description
Owned MLX device handle released exactly once through the official C API.
Implementations§
Source§impl MlxDeviceHandle
impl MlxDeviceHandle
Sourcepub fn of_type(
device_type: mlx_device_type,
device_index: i32,
) -> Result<Self, MlxCError>
pub fn of_type( device_type: mlx_device_type, device_index: i32, ) -> Result<Self, MlxCError>
Creates an owned device handle for one backend device type and index.
Sourcepub fn default_device() -> Result<Self, MlxCError>
pub fn default_device() -> Result<Self, MlxCError>
The process’s default device.
Sourcepub fn set_as_default(&self) -> Result<(), MlxCError>
pub fn set_as_default(&self) -> Result<(), MlxCError>
Replaces the process’s default device.
Sourcepub fn set(&mut self, source: &Self) -> Result<(), MlxCError>
pub fn set(&mut self, source: &Self) -> Result<(), MlxCError>
Copies the source device handle into this handle.
Sourcepub fn device_type(&self) -> Result<mlx_device_type, MlxCError>
pub fn device_type(&self) -> Result<mlx_device_type, MlxCError>
The device’s backend type.
Sourcepub fn is_available(&self) -> Result<bool, MlxCError>
pub fn is_available(&self) -> Result<bool, MlxCError>
Whether the backend device is available in this process.
Sourcepub fn count_of_type(device_type: mlx_device_type) -> Result<i32, MlxCError>
pub fn count_of_type(device_type: mlx_device_type) -> Result<i32, MlxCError>
How many devices the backend exposes.
Sourcepub fn to_string_lossy(&self) -> Result<String, MlxCError>
pub fn to_string_lossy(&self) -> Result<String, MlxCError>
Renders the device description text.
Sourcepub fn information(&self) -> Result<MlxDeviceInfo, MlxCError>
pub fn information(&self) -> Result<MlxDeviceInfo, MlxCError>
The device’s key/value information table.
Trait Implementations§
Source§impl Debug for MlxDeviceHandle
impl Debug for MlxDeviceHandle
Source§impl Drop for MlxDeviceHandle
impl Drop for MlxDeviceHandle
Auto Trait Implementations§
impl !Send for MlxDeviceHandle
impl !Sync for MlxDeviceHandle
impl Freeze for MlxDeviceHandle
impl RefUnwindSafe for MlxDeviceHandle
impl Unpin for MlxDeviceHandle
impl UnsafeUnpin for MlxDeviceHandle
impl UnwindSafe for MlxDeviceHandle
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