pub struct PjrtPlugin { /* private fields */ }Expand description
Dynamically loaded PJRT plugin.
§Examples
use tenferro_xla::{Error, PjrtPlugin};
let err = PjrtPlugin::load_from_env("__TENFERRO_XLA_DOCS_UNSET").unwrap_err();
assert!(matches!(err, Error::MissingEnv { .. }));Implementations§
Source§impl PjrtPlugin
impl PjrtPlugin
Sourcepub fn load_from_env(var: &'static str) -> Result<Self>
pub fn load_from_env(var: &'static str) -> Result<Self>
Load a PJRT plugin path from an environment variable.
§Examples
use tenferro_xla::{Error, PjrtPlugin};
let err = PjrtPlugin::load_from_env("__TENFERRO_XLA_DOCS_UNSET").unwrap_err();
assert!(matches!(err, Error::MissingEnv { .. }));§Errors
Returns Error::MissingEnv when var is unset, or Error::PluginLoad
with the typed dynamic-library source when loading or symbol lookup
fails.
Sourcepub fn load_path(path: impl Into<PathBuf>) -> Result<Self>
pub fn load_path(path: impl Into<PathBuf>) -> Result<Self>
Load a PJRT plugin from an explicit dynamic-library path.
§Examples
use tenferro_xla::{Error, PjrtPlugin};
let err = PjrtPlugin::load_path("/definitely/missing/pjrt.so").unwrap_err();
assert!(matches!(err, Error::PluginLoad { .. }));§Errors
Returns Error::PluginLoad with the original dynamic-library error as
its source when the file cannot be opened or GetPjrtApi is missing,
or Error::PjrtCall when the plugin returns a null API table.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PjrtPlugin
impl RefUnwindSafe for PjrtPlugin
impl !Send for PjrtPlugin
impl !Sync for PjrtPlugin
impl Unpin for PjrtPlugin
impl UnsafeUnpin for PjrtPlugin
impl UnwindSafe for PjrtPlugin
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
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>
Converts
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>
Converts
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