feat: take Path in FileBasedCertVerifier::init
This commit is contained in:
parent
32895e5b65
commit
3359c3c9fd
1 changed files with 4 additions and 4 deletions
|
@ -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 dashmap::DashMap;
|
||||||
use tokio::io::AsyncBufReadExt;
|
use tokio::io::AsyncBufReadExt;
|
||||||
|
@ -18,11 +18,11 @@ pub struct FileBasedCertVerifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileBasedCertVerifier {
|
impl FileBasedCertVerifier {
|
||||||
pub async fn init(path: &str) -> Result<Self, LibError> {
|
pub async fn init(path: impl AsRef<Path>) -> Result<Self, LibError> {
|
||||||
let map = DashMap::new();
|
let map = DashMap::new();
|
||||||
|
|
||||||
if tokio::fs::try_exists(path).await? {
|
if tokio::fs::try_exists(&path).await? {
|
||||||
let mut f = tokio::fs::OpenOptions::new().read(true).open(path).await?;
|
let mut f = tokio::fs::OpenOptions::new().read(true).open(&path).await?;
|
||||||
|
|
||||||
let mut reader = tokio::io::BufReader::new(&mut f);
|
let mut reader = tokio::io::BufReader::new(&mut f);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue