Some checks failed
actionlint check / actionlint check (pull_request) Successful in 5s
checkov check / checkov check (pull_request) Successful in 52s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 4s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 2s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 5s
GitLeaks check / GitLeaks check (pull_request) Successful in 6s
hadolint check / hadolint check (pull_request) Successful in 7s
htmlhint check / htmlhint check (pull_request) Successful in 9s
markdownlint check / markdownlint check (pull_request) Successful in 9s
Prettier check / Prettier check (pull_request) Successful in 10s
Rust check / Rust check (pull_request) Failing after 6m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 12s
Stylelint check / Stylelint check (pull_request) Successful in 11s
yamllint check / yamllint check (pull_request) Successful in 13s
46 lines
1.0 KiB
Rust
46 lines
1.0 KiB
Rust
use serde::Deserialize;
|
|
use serde_with::serde_derive::Serialize;
|
|
use std::fmt::Display;
|
|
use std::str::FromStr;
|
|
|
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
|
pub struct ErrorVec<T> {
|
|
errors: Vec<T>,
|
|
}
|
|
|
|
impl<T> From<ErrorVec<T>> for Vec<T> {
|
|
fn from(e: ErrorVec<T>) -> Self {
|
|
e.errors
|
|
}
|
|
}
|
|
|
|
impl<T> From<Vec<T>> for ErrorVec<T> {
|
|
fn from(e: Vec<T>) -> Self {
|
|
ErrorVec { errors: e }
|
|
}
|
|
}
|
|
|
|
// has to be implemented for Dioxus server functions
|
|
impl<T: Display> Display for ErrorVec<T> {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(
|
|
f,
|
|
"{}",
|
|
self.errors
|
|
.iter()
|
|
.map(|e| e.to_string())
|
|
.collect::<Vec<String>>()
|
|
.join("\n")
|
|
)
|
|
}
|
|
}
|
|
|
|
// has to be implemented for Dioxus server functions
|
|
impl<T> FromStr for ErrorVec<T> {
|
|
type Err = ();
|
|
|
|
fn from_str(_: &str) -> Result<Self, Self::Err> {
|
|
Ok(ErrorVec { errors: Vec::new() })
|
|
}
|
|
}
|