pub async fn is_file_writable(path: &Path) -> RlgResult<bool>
Expand description
Checks if a file exists and is writable.
§Arguments
path
- A reference to aPath
that holds the file path to check.
§Returns
A RlgResult<bool>
which is Ok(true)
if the file exists and is writable,
Ok(false)
otherwise, or an error if the operation fails.
§Examples
use rlg::utils::is_file_writable;
use std::path::Path;
#[tokio::main]
async fn main() -> rlg::error::RlgResult<()> {
let path = Path::new("example.log");
let is_writable = is_file_writable(&path).await?;
println!("Is file writable: {}", is_writable);
Ok(())
}