Skip to main content

Transfer

Struct Transfer 

Source
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: TransferId

Unique transfer ID

§direction: TransferDirection

Transfer direction

§source: MemoryLocation

Source memory location

§destination: MemoryLocation

Destination memory location

§size_bytes: u64

Total transfer size in bytes

§transferred_bytes: u64

Bytes transferred so far

§start_time: Instant

Transfer start time

§end_time: Option<Instant>

Transfer end time (if completed)

§status: TransferStatus

Transfer status

§label: String

Human-readable label

Implementations§

Source§

impl Transfer

Source

pub fn new( direction: TransferDirection, source: MemoryLocation, destination: MemoryLocation, size_bytes: u64, ) -> Self

Create a new transfer

Source

pub fn host_to_device(size_bytes: u64, device_id: DeviceId) -> Self

Create H2D transfer

Source

pub fn device_to_host(size_bytes: u64, device_id: DeviceId) -> Self

Create D2H transfer

Source

pub fn with_label(self, label: impl Into<String>) -> Self

Set label

Source

pub fn progress_pct(&self) -> f64

Get transfer progress percentage (0.0-100.0)

Source

pub fn elapsed(&self) -> Duration

Get elapsed time

Source

pub fn elapsed_ms(&self) -> f64

Get elapsed time in milliseconds

Source

pub fn bandwidth_gbps(&self) -> f64

Get current bandwidth in GB/s

Source

pub fn update_progress(&mut self, bytes_transferred: u64)

Update transfer progress

Source

pub fn complete(&mut self)

Mark transfer as complete

Source

pub fn fail(&mut self, _reason: &str)

Mark transfer as failed

Trait Implementations§

Source§

impl Clone for Transfer

Source§

fn clone(&self) -> Transfer

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Transfer

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.