mirror of
https://github.com/Hopiu/lychee.git
synced 2026-04-01 04:10:24 +00:00
Add support for serializing input
This commit is contained in:
parent
d6b960368a
commit
d9adfbf80f
1 changed files with 10 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ use tokio::io::{stdin, AsyncReadExt};
|
|||
|
||||
const STDIN: &str = "-";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[non_exhaustive]
|
||||
pub enum Input {
|
||||
RemoteUrl(Url),
|
||||
|
|
@ -25,6 +25,15 @@ pub enum Input {
|
|||
String(String),
|
||||
}
|
||||
|
||||
impl Serialize for Input {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.collect_str(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Input {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
|
|
|
|||
Loading…
Reference in a new issue