From 66ded1ec598639fd54a75d6af007ed60541df5ca Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 24 Aug 2024 11:21:23 +0200 Subject: feat(bytes): Add implementation for serde's `Serialize` --- crates/bytes/src/serde.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 crates/bytes/src/serde.rs (limited to 'crates/bytes/src/serde.rs') diff --git a/crates/bytes/src/serde.rs b/crates/bytes/src/serde.rs new file mode 100644 index 0000000..4341e32 --- /dev/null +++ b/crates/bytes/src/serde.rs @@ -0,0 +1,19 @@ +// yt - A fully featured command line YouTube client +// +// Copyright (C) 2024 Benedikt Peetz +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of Yt. +// +// You should have received a copy of the License along with this program. +// If not, see . + +use serde::{Serialize, Serializer}; + +use crate::Bytes; + +impl Serialize for Bytes { + fn serialize(&self, serializer: S) -> Result { + serializer.serialize_str(self.to_string().as_str()) + } +} -- cgit 1.4.1