kdeconnect-proto 0.1.2

A pure Rust modular implementation of the KDE Connect protocol
Documentation
//! The Clipboard plugin allows syncing clipboard text content between devices.
use serde::{Deserialize, Serialize};

#[cfg(not(feature = "std"))]
use alloc::string::String;

/// This packet is sent when the clipboard content changes. In other words, it is typically sent when the selection owner changes.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectclipboard>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ClipboardPacket {
    /// Text content of the clipboard.
    pub content: String,
}

/// This packet is only sent when a device connects.
///
/// <https://invent.kde.org/network/kdeconnect-meta/blob/master/protocol.md#kdeconnectclipboardconnect>
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ClipboardConnectPacket {
    /// Text content of the clipboard.
    pub content: String,

    /// UNIX epoch timestamp (ms) for the clipboard content. If the timestamp is 0 or less than the local timestamp, the content should be ignored.
    #[serde(deserialize_with = "super::deserialize_number_or_string")]
    pub timestamp: u64,
}