1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#![doc(html_logo_url = "http://test.fractal.global/img/logo.svg",
       html_favicon_url = "http://test.fractal.global/img/favicon32.png",
       html_root_url = "http://fractal.global/dto-rs/")]
//! This crate contains the data type objects for Fractal Global. It contains the objects
//! sent to the fractal api.
//!
//!
//! Using it is as simple as including this in the crate:
//!
//! ```
//! extern crate fractal_dto;
//! ```
#![forbid(missing_docs, warnings)]
#![deny(deprecated, improper_ctypes, non_shorthand_field_patterns, overflowing_literals,
    plugin_as_library, private_no_mangle_fns, private_no_mangle_statics, stable_features,
    unconditional_recursion, unknown_lints, unused, unused_allocation, unused_attributes,
    unused_comparisons, unused_features, unused_parens, while_true)]
#![warn(trivial_casts, trivial_numeric_casts, unused, unused_extern_crates, unused_import_braces,
    unused_qualifications, unused_results, variant_size_differences)]
extern crate rustc_serialize;
extern crate chrono;
extern crate fractal_utils as utils;

use rustc_serialize::{Encodable, Decodable};

pub mod error;
pub use error::FromDTOError;

pub mod v1;
pub use v1::*;

/// The dto trate to make it Encodeable and Decodable into fractal objects
pub trait DTO: Encodable + Decodable {}

/// creates an object from a dto
pub trait FromDTO<D: DTO>: Sized {
    /// the from dto wrapper
    fn from_dto(dto: D) -> Result<Self, FromDTOError>;
}