From 3359c3c9fdb88957a5aab432136c8c40ca4eafd5 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 9 Aug 2024 12:41:23 +0400 Subject: [PATCH] feat: take Path in FileBasedCertVerifier::init --- src/certs/file_sscv.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/certs/file_sscv.rs b/src/certs/file_sscv.rs index 82b60eb..8a4ae27 100644 --- a/src/certs/file_sscv.rs +++ b/src/certs/file_sscv.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, io::Write, os::fd::AsFd, sync::Mutex}; +use std::{borrow::Cow, io::Write, os::fd::AsFd, path::Path, sync::Mutex}; use dashmap::DashMap; use tokio::io::AsyncBufReadExt; @@ -18,11 +18,11 @@ pub struct FileBasedCertVerifier { } impl FileBasedCertVerifier { - pub async fn init(path: &str) -> Result { + pub async fn init(path: impl AsRef) -> Result { let map = DashMap::new(); - if tokio::fs::try_exists(path).await? { - let mut f = tokio::fs::OpenOptions::new().read(true).open(path).await?; + if tokio::fs::try_exists(&path).await? { + let mut f = tokio::fs::OpenOptions::new().read(true).open(&path).await?; let mut reader = tokio::io::BufReader::new(&mut f);