pub struct DomainSet(/* private fields */);Expand description
A set of MemoryDomainKinds a producer can emit or a consumer can accept,
packed into a bitmask. The allocation query negotiates a single concrete
domain by intersecting the producer’s capability set with the consumer’s
acceptance set and picking the most-preferred survivor
(preferred). A single-domain producer/consumer (the
default) is just only, so the negotiation reduces to today’s
exact-match behavior; a multi-domain element (a decoder that can deliver to
System or stay resident on the GPU) names every domain it can satisfy.
Implementations§
Source§impl DomainSet
impl DomainSet
Sourcepub const EMPTY: Self
pub const EMPTY: Self
The empty set: no domain. The intersection result that signals an irreconcilable conflict (producer and consumer share no domain).
Sourcepub const ALL: Self
pub const ALL: Self
Every domain. The default input acceptance of an element (it imposes no
domain requirement on its upstream), so the converter auto-plug only acts
on elements that declare a narrower input_domains.
Sourcepub fn iter(self) -> impl Iterator<Item = MemoryDomainKind>
pub fn iter(self) -> impl Iterator<Item = MemoryDomainKind>
Iterate the member domains in preference order (GPU-resident first).
Sourcepub const fn only(k: MemoryDomainKind) -> Self
pub const fn only(k: MemoryDomainKind) -> Self
The singleton set holding just k. The default capability/acceptance of
every element, derived from its single output_memory().
Sourcepub const fn with(self, k: MemoryDomainKind) -> Self
pub const fn with(self, k: MemoryDomainKind) -> Self
This set with k added.
Sourcepub const fn contains(self, k: MemoryDomainKind) -> bool
pub const fn contains(self, k: MemoryDomainKind) -> bool
Whether k is a member.
Sourcepub const fn intersect(self, other: Self) -> Self
pub const fn intersect(self, other: Self) -> Self
The set of domains in both self and other (the domains a producer and
consumer can agree on).
Sourcepub fn preferred(self) -> Option<MemoryDomainKind>
pub fn preferred(self) -> Option<MemoryDomainKind>
The most-preferred member per [DOMAIN_PREFERENCE] (GPU-resident before
System), or None if the set is empty. The single concrete domain the
negotiation settles on.