ruma-common 0.9.3

Common types for other ruma crates.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! `Serialize` and `Deserialize` implementations for extensible events (MSC1767).

use std::convert::TryFrom;

use serde::Deserialize;

use super::{Amplitude, Waveform, WaveformError};

#[derive(Debug, Default, Deserialize)]
pub(crate) struct WaveformSerDeHelper(Vec<Amplitude>);

impl TryFrom<WaveformSerDeHelper> for Waveform {
    type Error = WaveformError;

    fn try_from(helper: WaveformSerDeHelper) -> Result<Self, Self::Error> {
        Waveform::try_from(helper.0)
    }
}