Accept bigger variety of paths for pager

This commit is contained in:
niku 2023-08-13 13:16:36 +02:00
parent c4ce04d700
commit 53870fecce

View File

@ -1,9 +1,10 @@
use std::{
fs::{File, OpenOptions},
os::unix::prelude::FileExt,
path::Path,
};
use crate::layout::*;
use crate::{cursor::Position, layout::*};
use anyhow::Result;
use thiserror::Error;
@ -23,7 +24,7 @@ pub struct Pager {
}
impl Pager {
pub fn new(file_path: &str) -> Result<Self> {
pub fn new<T: AsRef<Path>>(file_path: T) -> Result<Self> {
let file = OpenOptions::new()
.read(true)
.write(true)