pub struct LoadCanceler(/* private fields */);Available on crate feature
api-22 only.Expand description
A handle which can be used to remotely terminate an in-progress session load.
Implementations§
Source§impl LoadCanceler
impl LoadCanceler
Sourcepub fn cancel(&self) -> Result<()>
pub fn cancel(&self) -> Result<()>
Cancels any active session commits.
let mut builder = Session::builder()?
.with_optimization_level(GraphOptimizationLevel::Level1)?
.with_intra_threads(1)?;
let canceler = builder.canceler();
thread::spawn(move || {
thread::sleep(Duration::from_millis(500));
// timeout if model hasn't loaded in 500ms
let _ = canceler.cancel();
});
let session = builder.commit_from_file("tests/data/upsample.onnx")?;Trait Implementations§
Source§impl Clone for LoadCanceler
impl Clone for LoadCanceler
Source§fn clone(&self) -> LoadCanceler
fn clone(&self) -> LoadCanceler
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 LoadCanceler
impl Debug for LoadCanceler
impl Send for LoadCanceler
impl Sync for LoadCanceler
Auto Trait Implementations§
impl Freeze for LoadCanceler
impl RefUnwindSafe for LoadCanceler
impl Unpin for LoadCanceler
impl UnsafeUnpin for LoadCanceler
impl UnwindSafe for LoadCanceler
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