add some documentation

This commit is contained in:
Marc-Antoine Arnaud 2020-02-24 18:42:09 +01:00
parent 13d6db9280
commit a79da97a46
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,6 @@
//! Generic data structure deserialization framework.
//!
use std::io::Read;
use xml::name::OwnedName;
use xml::reader::{EventReader, ParserConfig, XmlEvent};

View File

@ -1,3 +1,8 @@
//! # YaSerDe
//!
//! YaSerDe is a framework for ***ser***ializing and ***de***serializing Rust data
//! structures efficiently and generically from and into XML.
#[macro_use]
extern crate log;
extern crate xml;
@ -12,14 +17,18 @@ use xml::writer::XmlEvent;
pub mod de;
pub mod ser;
/// A **data structure** that can be deserialized from any data format supported by YaSerDe.
pub trait YaDeserialize: Sized {
fn deserialize<R: Read>(reader: &mut de::Deserializer<R>) -> Result<Self, String>;
}
/// A **data structure** that can be serialized into any data format supported by YaSerDe.
pub trait YaSerialize: Sized {
fn serialize<W: Write>(&self, writer: &mut ser::Serializer<W>) -> Result<(), String>;
}
/// A **visitor** that can be implemented to retrieve information from source file.
pub trait Visitor<'de>: Sized {
/// The value produced by this visitor.
type Value;

View File

@ -1,3 +1,6 @@
//! Generic data structure serialization framework.
//!
use std::io::{Cursor, Write};
use std::str;
use xml;