gondola_core/io/
caraspace.rs

1//! The following file is part of gaps-online-software and published 
2//! under the GPLv3 license
3
4mod reader; 
5pub use reader::CRReader;
6pub mod writer;
7pub use writer::CRWriter;
8
9pub mod frame;
10pub use frame::{
11  CRFrameObjectType,
12  CRFrameObject,
13  CRFrame,
14};
15
16use crate::prelude::Serialization;
17
18/// Allows to pack a certain structure within 
19/// a CRFrameObject
20pub trait Frameable {
21  const CRFRAMEOBJECT_TYPE : CRFrameObjectType;
22
23  /// Wrap myself in a CRFrameObject
24  fn pack(&self) -> CRFrameObject 
25    where Self: Serialization {
26    let mut cr     = CRFrameObject::new();
27    cr.payload     = self.to_bytestream();
28    cr.ftype       = Self::CRFRAMEOBJECT_TYPE;
29    //cr.size        = cr.payload.len();
30    cr
31  }
32}
33