diff options
| author | Max Audron <audron@cocaine.farm> | 2025-03-01 20:00:36 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-03-01 20:02:12 +0100 |
| commit | 09bdd93113e46a5ee909190d23a2638c5f4f010b (patch) | |
| tree | 8bf27da0c09317302e6c3b2d2020ac2b7403b650 /src/message/signalproxy/rpccall/bufferinfo.rs | |
| parent | add UserType implementation for required signalproxy objects (diff) | |
implement rpc calls
Diffstat (limited to 'src/message/signalproxy/rpccall/bufferinfo.rs')
| -rw-r--r-- | src/message/signalproxy/rpccall/bufferinfo.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/message/signalproxy/rpccall/bufferinfo.rs b/src/message/signalproxy/rpccall/bufferinfo.rs new file mode 100644 index 0000000..7ba2757 --- /dev/null +++ b/src/message/signalproxy/rpccall/bufferinfo.rs @@ -0,0 +1,36 @@ +use crate::primitive::{BufferInfo, Variant}; + +use super::{Direction, RpcCallType}; + +#[derive(Clone, Debug, PartialEq)] +pub struct BufferInfoUpdated { + buffer: BufferInfo, +} + +impl RpcCallType for BufferInfoUpdated { + const NAME: &str = "2bufferInfoUpdated(BufferInfo)"; + const DIRECTION: Direction = Direction::ServerToClient; + + fn to_network(&self) -> Result<Vec<crate::primitive::Variant>, crate::ProtocolError> { + Ok(vec![ + Variant::ByteArray(Self::NAME.to_string()), + self.buffer.clone().into(), + ]) + } + + fn from_network( + size: usize, + input: &mut crate::primitive::VariantList, + ) -> Result<(usize, super::RpcCall), crate::ProtocolError> + where + Self: Sized, + { + Ok(( + size, + Self { + buffer: match_variant!(input.remove(0), Variant::BufferInfo), + } + .into(), + )) + } +} |
