Skip to main content

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;
8pub mod frame_header; 
9pub use frame_header::{
10  CRFRAMEHEADER_NAME,
11  CRFrameHeader,
12  CRFrameType,
13  GapsDataSource,
14};
15pub mod file_summary;
16pub use file_summary::{
17  CRFileSummary,
18  CRFILESUMMARY_NAME,
19  CRFILESUMMARY_MAGIC,
20};
21pub mod frame;
22pub use frame::{
23  CRFrameObjectType,
24  CRFrameObject,
25  CRFrame,
26};
27
28use crate::prelude::Serialization;
29
30/// Allows to pack a certain structure within 
31/// a CRFrameObject
32pub trait Frameable {
33  const CRFRAMEOBJECT_TYPE : CRFrameObjectType;
34
35  /// Wrap myself in a CRFrameObject
36  fn pack(&self) -> CRFrameObject 
37    where Self: Serialization {
38    let mut cr     = CRFrameObject::new();
39    cr.payload     = self.to_bytestream();
40    cr.ftype       = Self::CRFRAMEOBJECT_TYPE;
41    //cr.size        = cr.payload.len();
42    cr
43  }
44}
45