Add diff applying error & improve CI #32

Merged
schmelczer merged 12 commits from asch/diff-error into main 2025-12-06 21:54:08 +00:00
Showing only changes of commit 25d9ab34d5 - Show all commits
Andras Schmelczer 2025-12-06 11:50:18 +00:00

View file

@ -1,5 +1,4 @@
use std::borrow::Cow; use std::{borrow::Cow, fmt::Debug};
use std::fmt::Debug;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -59,27 +58,19 @@ impl From<NumberOrString> for JsValue {
} }
impl From<i64> for NumberOrString { impl From<i64> for NumberOrString {
fn from(value: i64) -> Self { fn from(value: i64) -> Self { NumberOrString::Number(value) }
NumberOrString::Number(value)
}
} }
impl From<String> for NumberOrString { impl From<String> for NumberOrString {
fn from(value: String) -> Self { fn from(value: String) -> Self { NumberOrString::Text(value) }
NumberOrString::Text(value)
}
} }
impl From<&str> for NumberOrString { impl From<&str> for NumberOrString {
fn from(value: &str) -> Self { fn from(value: &str) -> Self { NumberOrString::Text(value.to_owned()) }
NumberOrString::Text(value.to_string())
}
} }
impl<'a> From<Cow<'a, str>> for NumberOrString { impl<'a> From<Cow<'a, str>> for NumberOrString {
fn from(value: Cow<'a, str>) -> Self { fn from(value: Cow<'a, str>) -> Self { NumberOrString::Text(value.into_owned()) }
NumberOrString::Text(value.into_owned())
}
} }
/// Error type for deserialisation failures /// Error type for deserialisation failures
@ -110,7 +101,5 @@ impl std::error::Error for DeserialisationError {}
#[cfg(feature = "wasm")] #[cfg(feature = "wasm")]
impl From<DeserialisationError> for JsValue { impl From<DeserialisationError> for JsValue {
fn from(error: DeserialisationError) -> Self { fn from(error: DeserialisationError) -> Self { JsValue::from_str(&error.message) }
JsValue::from_str(&error.message)
}
} }