pub struct MemoryResource {
pub id: String,
pub name: String,
pub kind: MemoryResourceKind,
pub total_bytes: Option<u64>,
pub available_bytes: Option<u64>,
pub capacity_source: CapacitySource,
pub device_identity: Option<DeviceIdentity>,
}Expand description
Snapshot of one physical memory resource.
Fields§
§id: StringStable resource identifier.
name: StringHuman-readable resource name.
kind: MemoryResourceKindHost or accelerator memory.
total_bytes: Option<u64>Total capacity when observable.
available_bytes: Option<u64>Currently available capacity when observable.
capacity_source: CapacitySourceSource of capacity information.
device_identity: Option<DeviceIdentity>Accelerator identity used to refresh platform telemetry.
Implementations§
Source§impl MemoryResource
impl MemoryResource
Sourcepub fn adaptive_device(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn adaptive_device(id: impl Into<String>, name: impl Into<String>) -> Self
Creates an accelerator resource whose physical capacity is unavailable.
Sourcepub fn discover_device(
id: impl Into<String>,
name: impl Into<String>,
identity: DeviceIdentity,
fallback_bytes: u64,
) -> Self
pub fn discover_device( id: impl Into<String>, name: impl Into<String>, identity: DeviceIdentity, fallback_bytes: u64, ) -> Self
Discovers accelerator capacity from platform telemetry, falling back to an adaptive backend limit when dedicated-memory telemetry is absent.
Sourcepub fn with_capacity(
self,
total_bytes: u64,
available_bytes: Option<u64>,
) -> Self
pub fn with_capacity( self, total_bytes: u64, available_bytes: Option<u64>, ) -> Self
Creates a resource with an explicit user-provided capacity.
Sourcepub const fn budget(&self, budget: MemoryBudget) -> MemoryBudget
pub const fn budget(&self, budget: MemoryBudget) -> MemoryBudget
Creates a budget bound to this resource.
Trait Implementations§
Source§impl Clone for MemoryResource
impl Clone for MemoryResource
Source§fn clone(&self) -> MemoryResource
fn clone(&self) -> MemoryResource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryResource
impl Debug for MemoryResource
Source§impl<'de> Deserialize<'de> for MemoryResource
impl<'de> Deserialize<'de> for MemoryResource
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MemoryResource
Source§impl PartialEq for MemoryResource
impl PartialEq for MemoryResource
Source§impl Serialize for MemoryResource
impl Serialize for MemoryResource
impl StructuralPartialEq for MemoryResource
Auto Trait Implementations§
impl Freeze for MemoryResource
impl RefUnwindSafe for MemoryResource
impl Send for MemoryResource
impl Sync for MemoryResource
impl Unpin for MemoryResource
impl UnsafeUnpin for MemoryResource
impl UnwindSafe for MemoryResource
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