Skip to content

Commit

Permalink
Remove unused UniResult
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Oct 7, 2024
1 parent 31cd08e commit d33198c
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src-native/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use anyhow::{Context, Result};
use serde::de::DeserializeOwned;
use std::fs::File;
use std::io::BufReader;
use std::mem;
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};

Expand Down Expand Up @@ -45,35 +44,6 @@ fn str_to_option(s: String) -> Option<String> {
}
}

pub type UniResult<T> = std::result::Result<T, UniError>;

pub struct UniError {
pub message: String,
}
impl From<String> for UniError {
fn from(message: String) -> Self {
Self { message }
}
}
impl From<&str> for UniError {
fn from(message: &str) -> Self {
Self {
message: message.to_string(),
}
}
}
impl From<UniError> for napi::Error {
fn from(ue: UniError) -> Self {
Self::from_reason(ue.message)
}
}
impl From<napi::Error> for UniError {
fn from(mut n_err: napi::Error) -> Self {
let message = mem::replace(&mut n_err.reason, "".to_string());
UniError { message }
}
}

fn path_to_json<J>(path: PathBuf) -> Result<J>
where
J: DeserializeOwned,
Expand Down

0 comments on commit d33198c

Please sign in to comment.