ort 2.0.0-rc.12

A safe Rust wrapper for ONNX Runtime 1.24 - Optimize and accelerate machine learning inference & training
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::sync::Mutex as StdMutex;
pub use std::sync::MutexGuard;

#[repr(transparent)]
pub struct Mutex<T>(StdMutex<T>);

impl<T> Mutex<T> {
	pub const fn new(data: T) -> Self {
		Self(StdMutex::new(data))
	}

	pub fn lock(&self) -> MutexGuard<'_, T> {
		match self.0.lock() {
			Ok(guard) => guard,
			Err(_) => panic!("Mutex poisoned")
		}
	}
}