pub struct Transfer {
pub id: TransferId,
pub direction: TransferDirection,
pub source: MemoryLocation,
pub destination: MemoryLocation,
pub size_bytes: u64,
pub transferred_bytes: u64,
pub start_time: Instant,
pub end_time: Option<Instant>,
pub status: TransferStatus,
pub label: String,
}Expand description
Memory transfer between host and device
Fields§
§id: TransferIdUnique transfer ID
direction: TransferDirectionTransfer direction
source: MemoryLocationSource memory location
destination: MemoryLocationDestination memory location
size_bytes: u64Total transfer size in bytes
transferred_bytes: u64Bytes transferred so far
start_time: InstantTransfer start time
end_time: Option<Instant>Transfer end time (if completed)
status: TransferStatusTransfer status
label: StringHuman-readable label
Implementations§
Source§impl Transfer
impl Transfer
Sourcepub fn new(
direction: TransferDirection,
source: MemoryLocation,
destination: MemoryLocation,
size_bytes: u64,
) -> Self
pub fn new( direction: TransferDirection, source: MemoryLocation, destination: MemoryLocation, size_bytes: u64, ) -> Self
Create a new transfer
Sourcepub fn host_to_device(size_bytes: u64, device_id: DeviceId) -> Self
pub fn host_to_device(size_bytes: u64, device_id: DeviceId) -> Self
Create H2D transfer
Sourcepub fn device_to_host(size_bytes: u64, device_id: DeviceId) -> Self
pub fn device_to_host(size_bytes: u64, device_id: DeviceId) -> Self
Create D2H transfer
Sourcepub fn with_label(self, label: impl Into<String>) -> Self
pub fn with_label(self, label: impl Into<String>) -> Self
Set label
Sourcepub fn progress_pct(&self) -> f64
pub fn progress_pct(&self) -> f64
Get transfer progress percentage (0.0-100.0)
Sourcepub fn elapsed_ms(&self) -> f64
pub fn elapsed_ms(&self) -> f64
Get elapsed time in milliseconds
Sourcepub fn bandwidth_gbps(&self) -> f64
pub fn bandwidth_gbps(&self) -> f64
Get current bandwidth in GB/s
Sourcepub fn update_progress(&mut self, bytes_transferred: u64)
pub fn update_progress(&mut self, bytes_transferred: u64)
Update transfer progress
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transfer
impl RefUnwindSafe for Transfer
impl Send for Transfer
impl Sync for Transfer
impl Unpin for Transfer
impl UnsafeUnpin for Transfer
impl UnwindSafe for Transfer
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