mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
fix: appease clippy
This commit is contained in:
@@ -1 +1 @@
|
||||
msrv = "1.70"
|
||||
msrv = "1.72"
|
||||
|
||||
@@ -3,7 +3,7 @@ name = "ort-sys"
|
||||
description = "Unsafe Rust bindings for ONNX Runtime 1.20 - Optimize and Accelerate Machine Learning Inferencing"
|
||||
version = "2.0.0-rc.9"
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
rust-version = "1.72"
|
||||
links = "onnxruntime"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/pykeio/ort"
|
||||
|
||||
@@ -91,8 +91,8 @@ fn copy_libraries(lib_dir: &Path, out_dir: &Path) {
|
||||
|
||||
let lib_files = std::fs::read_dir(lib_dir).unwrap_or_else(|_| panic!("Failed to read contents of `{}` (does it exist?)", lib_dir.display()));
|
||||
for lib_file in lib_files.filter(|e| {
|
||||
e.as_ref().ok().map_or(false, |e| {
|
||||
e.file_type().map_or(false, |e| !e.is_dir()) && [".dll", ".so", ".dylib"].into_iter().any(|v| e.path().to_string_lossy().contains(v))
|
||||
e.as_ref().ok().is_some_and(|e| {
|
||||
e.file_type().is_ok_and(|e| !e.is_dir()) && [".dll", ".so", ".dylib"].into_iter().any(|v| e.path().to_string_lossy().contains(v))
|
||||
})
|
||||
}) {
|
||||
let lib_file = lib_file.unwrap();
|
||||
|
||||
@@ -35,7 +35,7 @@ impl KernelAttributes {
|
||||
|
||||
pub fn get<'s, T: GetKernelAttribute<'s>>(&'s self, name: impl AsRef<str>) -> Option<T> {
|
||||
let name = CString::new(name.as_ref()).ok()?;
|
||||
T::get_from(self.0.as_ptr(), name.as_ptr())
|
||||
unsafe { T::get_from(self.0.as_ptr(), name.as_ptr()) }
|
||||
}
|
||||
|
||||
pub fn inputs(&self) -> Result<Vec<Input>> {
|
||||
@@ -106,13 +106,13 @@ impl AsPointer for KernelAttributes {
|
||||
}
|
||||
|
||||
pub trait GetKernelAttribute<'s> {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
impl GetKernelAttribute<'_> for f32 {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
@@ -123,7 +123,7 @@ impl GetKernelAttribute<'_> for f32 {
|
||||
}
|
||||
|
||||
impl GetKernelAttribute<'_> for i64 {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
@@ -134,7 +134,7 @@ impl GetKernelAttribute<'_> for i64 {
|
||||
}
|
||||
|
||||
impl GetKernelAttribute<'_> for String {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
@@ -147,7 +147,7 @@ impl GetKernelAttribute<'_> for String {
|
||||
}
|
||||
|
||||
impl GetKernelAttribute<'_> for Vec<f32> {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
@@ -160,7 +160,7 @@ impl GetKernelAttribute<'_> for Vec<f32> {
|
||||
}
|
||||
|
||||
impl GetKernelAttribute<'_> for Vec<i64> {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
@@ -173,7 +173,7 @@ impl GetKernelAttribute<'_> for Vec<i64> {
|
||||
}
|
||||
|
||||
impl<'s, T: DowncastableTarget> GetKernelAttribute<'s> for ValueRef<'s, T> {
|
||||
fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
unsafe fn get_from(info: *mut ort_sys::OrtKernelInfo, name: *const ort_sys::c_char) -> Option<Self>
|
||||
where
|
||||
Self: Sized
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user