pub struct BackendId { /* private fields */ }Expand description
Stable provider identifier for logs and explicit selection.
Identity is stored inline as fixed-capacity UTF-8 rather than
&'static str, because accelerator backends (CUDA, HIP, Vulkan) enumerate
their devices at runtime and cannot produce 'static text without leaking.
Keeping the value inline preserves Copy, so BackendId can continue to
live inside GeomError variants and DevicePreference without forcing an
allocation or a lifetime onto the error type.
Implementations§
Source§impl BackendId
impl BackendId
Sourcepub const fn new(value: &str) -> BackendId
pub const fn new(value: &str) -> BackendId
Construct an identifier known at compile time.
§Panics
Panics if value exceeds BackendId::CAPACITY bytes. This is a
const fn, so an over-long literal fails the build rather than a test
run. Use BackendId::try_new for runtime-derived text.
Sourcepub fn try_new(value: &str) -> Result<BackendId, BackendIdTooLong>
pub fn try_new(value: &str) -> Result<BackendId, BackendIdTooLong>
Construct an identifier from runtime-derived text, such as a driver-enumerated device name.
§Errors
Returns BackendIdTooLong when the text exceeds
BackendId::CAPACITY bytes. The identity is never truncated.
Trait Implementations§
Source§impl Ord for BackendId
impl Ord for BackendId
Source§impl PartialOrd for BackendId
impl PartialOrd for BackendId
impl Copy for BackendId
impl Eq for BackendId
Auto Trait Implementations§
impl Freeze for BackendId
impl RefUnwindSafe for BackendId
impl Send for BackendId
impl Sync for BackendId
impl Unpin for BackendId
impl UnwindSafe for BackendId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more