mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-12 20:45:11 -05:00
cargo: version 0.17.0 with Rust 2018 edition
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
[package]
|
||||
name = "kbinxml"
|
||||
version = "0.16.0"
|
||||
version = "0.17.0"
|
||||
authors = ["Matt Bilker <me@mbilker.us>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
byteorder = "1.2.3"
|
||||
|
||||
@@ -6,10 +6,10 @@ use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||
use bytes::Bytes;
|
||||
use failure::ResultExt;
|
||||
|
||||
use node_types::KbinType;
|
||||
use crate::node_types::KbinType;
|
||||
|
||||
pub use encoding_type::EncodingType;
|
||||
pub use error::{KbinError, KbinErrorKind, Result};
|
||||
pub use crate::encoding_type::EncodingType;
|
||||
pub use crate::error::{KbinError, KbinErrorKind, Result};
|
||||
|
||||
/// Remove trailing null bytes, used for the `String` type
|
||||
pub(crate) fn strip_trailing_null_bytes<'a>(data: &'a [u8]) -> &'a [u8] {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use super::{SIG_COMPRESSED, SIG_UNCOMPRESSED};
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use serde::de::{self, IntoDeserializer, Visitor};
|
||||
|
||||
use de::custom::Custom;
|
||||
use de::definition::NodeDefinitionDeserializer;
|
||||
use de::node_contents::NodeContents;
|
||||
use de::seq::Seq;
|
||||
use de::structure::Struct;
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node::{Marshal, NodeCollection};
|
||||
use node_types::StandardType;
|
||||
use crate::de::custom::Custom;
|
||||
use crate::de::definition::NodeDefinitionDeserializer;
|
||||
use crate::de::node_contents::NodeContents;
|
||||
use crate::de::seq::Seq;
|
||||
use crate::de::structure::Struct;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node::{Marshal, NodeCollection};
|
||||
use crate::node_types::StandardType;
|
||||
|
||||
fn warn_attributes(value: &NodeCollection) -> Result<(), Error> {
|
||||
for attr in value.attributes() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde::de::{Deserializer, DeserializeSeed, EnumAccess, Error, IntoDeserializer, VariantAccess, Visitor};
|
||||
|
||||
use node_types::StandardType;
|
||||
use crate::node_types::StandardType;
|
||||
|
||||
pub struct Custom<D> {
|
||||
de: D,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use serde::de::{self, IntoDeserializer, Visitor};
|
||||
|
||||
use de::custom::Custom;
|
||||
use de::seq::Seq;
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node::{Marshal, NodeCollection, NodeDefinition};
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::de::custom::Custom;
|
||||
use crate::de::seq::Seq;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node::{Marshal, NodeCollection, NodeDefinition};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
pub struct NodeDefinitionDeserializer<'a> {
|
||||
definition: &'a NodeDefinition,
|
||||
|
||||
@@ -3,9 +3,9 @@ use std::result::Result as StdResult;
|
||||
use bytes::Bytes;
|
||||
use serde::de::{self, Deserialize, Visitor};
|
||||
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node::NodeCollection;
|
||||
use reader::Reader;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node::NodeCollection;
|
||||
use crate::reader::Reader;
|
||||
|
||||
mod collection;
|
||||
mod custom;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use serde::de::{DeserializeSeed, IntoDeserializer, MapAccess};
|
||||
|
||||
use de::{Custom, Result};
|
||||
use de::definition::NodeDefinitionDeserializer;
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node::NodeCollection;
|
||||
use crate::de::{Custom, Result};
|
||||
use crate::de::definition::NodeDefinitionDeserializer;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node::NodeCollection;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum ReadState {
|
||||
|
||||
@@ -2,11 +2,11 @@ use std::collections::VecDeque;
|
||||
|
||||
use serde::de::{DeserializeSeed, IntoDeserializer, SeqAccess};
|
||||
|
||||
use de::collection::NodeCollectionDeserializer;
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node::NodeCollection;
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::de::collection::NodeCollectionDeserializer;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node::NodeCollection;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
enum SequenceMode {
|
||||
Struct {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use serde::de::{DeserializeSeed, IntoDeserializer, MapAccess};
|
||||
|
||||
use de::Custom;
|
||||
use de::collection::NodeCollectionDeserializer;
|
||||
use de::definition::NodeDefinitionDeserializer;
|
||||
use error::Error;
|
||||
use node::NodeCollection;
|
||||
use node_types::StandardType;
|
||||
use crate::de::Custom;
|
||||
use crate::de::collection::NodeCollectionDeserializer;
|
||||
use crate::de::definition::NodeDefinitionDeserializer;
|
||||
use crate::error::Error;
|
||||
use crate::node::NodeCollection;
|
||||
use crate::node_types::StandardType;
|
||||
|
||||
pub struct Struct<'a> {
|
||||
collection: &'a mut NodeCollection,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::fmt;
|
||||
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use failure::ResultExt;
|
||||
|
||||
/// The `encoding_rs` crate uses the following to describe their counterparts:
|
||||
|
||||
@@ -5,8 +5,8 @@ use std::string::FromUtf8Error;
|
||||
use failure::{Backtrace, Context, Fail};
|
||||
use quick_xml::Error as QuickXmlError;
|
||||
|
||||
use node_types::{KbinType, StandardType};
|
||||
use value::Value;
|
||||
use crate::node_types::{KbinType, StandardType};
|
||||
use crate::value::Value;
|
||||
|
||||
pub type Result<T> = StdResult<T, KbinError>;
|
||||
|
||||
|
||||
36
src/lib.rs
36
src/lib.rs
@@ -35,23 +35,23 @@ mod to_text_xml;
|
||||
mod value;
|
||||
mod writer;
|
||||
|
||||
use node::NodeDefinition;
|
||||
use text_reader::TextXmlReader;
|
||||
use to_text_xml::TextXmlWriter;
|
||||
use crate::node::NodeDefinition;
|
||||
use crate::text_reader::TextXmlReader;
|
||||
use crate::to_text_xml::TextXmlWriter;
|
||||
|
||||
// Public exports
|
||||
pub use compression::Compression;
|
||||
pub use encoding_type::EncodingType;
|
||||
pub use printer::Printer;
|
||||
pub use reader::Reader;
|
||||
pub use error::{KbinError, KbinErrorKind, Result};
|
||||
pub use node::{Node, NodeCollection};
|
||||
pub use node_types::StandardType;
|
||||
pub use options::Options;
|
||||
pub use to_element::ToElement;
|
||||
pub use to_text_xml::ToTextXml;
|
||||
pub use value::Value;
|
||||
pub use writer::{Writer, Writeable};
|
||||
pub use crate::compression::Compression;
|
||||
pub use crate::encoding_type::EncodingType;
|
||||
pub use crate::printer::Printer;
|
||||
pub use crate::reader::Reader;
|
||||
pub use crate::error::{KbinError, KbinErrorKind, Result};
|
||||
pub use crate::node::{Node, NodeCollection};
|
||||
pub use crate::node_types::StandardType;
|
||||
pub use crate::options::Options;
|
||||
pub use crate::to_element::ToElement;
|
||||
pub use crate::to_text_xml::ToTextXml;
|
||||
pub use crate::value::Value;
|
||||
pub use crate::writer::{Writer, Writeable};
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "serde")] {
|
||||
@@ -62,9 +62,9 @@ cfg_if! {
|
||||
mod de;
|
||||
mod ser;
|
||||
|
||||
pub use de::from_bytes as serde_from_bytes;
|
||||
pub use node::ExtraNodes;
|
||||
pub use ser::to_bytes as serde_to_bytes;
|
||||
pub use crate::de::from_bytes as serde_from_bytes;
|
||||
pub use crate::node::ExtraNodes;
|
||||
pub use crate::ser::to_bytes as serde_to_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
use std::iter::Iterator;
|
||||
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use node::{Node, NodeDefinition};
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use crate::node::{Node, NodeDefinition};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
fn parse_index(s: &str) -> Option<usize> {
|
||||
if s.starts_with('+') || (s.starts_with('0') && s.len() != 1) {
|
||||
|
||||
@@ -4,9 +4,9 @@ use std::marker::PhantomData;
|
||||
use serde::de::{self, Deserialize, DeserializeSeed, Error, EnumAccess, IntoDeserializer, MapAccess, SeqAccess, VariantAccess, Visitor};
|
||||
use serde::de::value::{MapDeserializer, SeqDeserializer};
|
||||
|
||||
use node::Node;
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::node::Node;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
pub(crate) struct NodeVisitor {
|
||||
key: Option<String>,
|
||||
@@ -21,7 +21,7 @@ impl<'de> NodeVisitor {
|
||||
match node_type {
|
||||
StandardType::Attribute => Err(A::Error::custom("`Attribute` nodes must be handled elsewhere")),
|
||||
StandardType::NodeStart => {
|
||||
let value = try!(map.next_value_seed(NodeValueSeed(key.to_owned())));
|
||||
let value = map.next_value_seed(NodeValueSeed(key.to_owned()))?;
|
||||
debug!("NodeVisitor::map_to_node(node_type: {:?}) => value: {:?}", node_type, value);
|
||||
|
||||
Ok(value)
|
||||
@@ -29,7 +29,7 @@ impl<'de> NodeVisitor {
|
||||
// Rolling up the `NodeStart` handling and other value types is not going
|
||||
// to happen as `NodeStart` nodes do not have a value
|
||||
node_type => {
|
||||
let node = try!(map.next_value_seed(NodeWithValueSeed(key.to_owned())));
|
||||
let node = map.next_value_seed(NodeWithValueSeed(key.to_owned()))?;
|
||||
debug!("NodeVisitor::map_to_node(node_type: {:?}) => node: {:?}", node_type, node);
|
||||
|
||||
Ok(node)
|
||||
@@ -53,20 +53,20 @@ impl<'de> Visitor<'de> for NodeVisitor {
|
||||
|
||||
let mut node = Node::new(self.key.unwrap_or_else(|| "".to_owned()));
|
||||
|
||||
while let Some(NodeStart { key, node_type }) = try!(map.next_key()) {
|
||||
while let Some(NodeStart { key, node_type }) = map.next_key()? {
|
||||
debug!("NodeVisitor::visit_map() => node_type: {:?}, key: {:?}", node_type, key);
|
||||
|
||||
if key == "__value" {
|
||||
trace!("NodeVisitor::visit_map() => got __value, getting node value");
|
||||
|
||||
let node_value = try!(map.next_value());
|
||||
let node_value = map.next_value()?;
|
||||
debug!("NodeVisitor::visit_map() => node value: {:?}", node_value);
|
||||
|
||||
node.set_value(Some(node_value));
|
||||
} else if key == "__node_key" {
|
||||
trace!("NodeVisitor::visit_map() => got __node_key, getting node key");
|
||||
|
||||
let node_key: String = try!(map.next_value());
|
||||
let node_key: String = map.next_value()?;
|
||||
debug!("NodeVisitor::visit_map() => node key: {:?}", node_key);
|
||||
|
||||
node.set_key(node_key);
|
||||
@@ -76,7 +76,7 @@ impl<'de> Visitor<'de> for NodeVisitor {
|
||||
let value = map.next_value();
|
||||
debug!("NodeVisitor::visit_map() => value: {:?}", value);
|
||||
|
||||
if let Value::Attribute(s) = try!(value) {
|
||||
if let Value::Attribute(s) = value? {
|
||||
//let key = String::from(&key["attr_".len()..]);
|
||||
node.set_attr(key, s);
|
||||
} else {
|
||||
|
||||
@@ -2,13 +2,13 @@ use std::fmt;
|
||||
|
||||
use bytes::Bytes;
|
||||
|
||||
use byte_buffer::strip_trailing_null_bytes;
|
||||
use encoding_type::EncodingType;
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use node::Node;
|
||||
use node_types::StandardType;
|
||||
use sixbit::{Sixbit, SixbitSize};
|
||||
use value::Value;
|
||||
use crate::byte_buffer::strip_trailing_null_bytes;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use crate::node::Node;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::sixbit::{Sixbit, SixbitSize};
|
||||
use crate::value::Value;
|
||||
|
||||
#[derive(Clone, Eq)]
|
||||
pub enum Key {
|
||||
|
||||
@@ -2,10 +2,10 @@ use std::fmt;
|
||||
|
||||
use serde::de::{self, Deserialize, Error, MapAccess, Visitor};
|
||||
|
||||
use node::Node;
|
||||
use node::extra::ExtraNodes;
|
||||
use node::marshal::{Marshal, MarshalValue};
|
||||
use value::Value;
|
||||
use crate::node::Node;
|
||||
use crate::node::extra::ExtraNodes;
|
||||
use crate::node::marshal::{Marshal, MarshalValue};
|
||||
use crate::value::Value;
|
||||
|
||||
impl<'de> Deserialize<'de> for ExtraNodes {
|
||||
#[inline]
|
||||
@@ -29,20 +29,20 @@ impl<'de> Deserialize<'de> for ExtraNodes {
|
||||
|
||||
let mut extra = ExtraNodes::new();
|
||||
|
||||
while let Some(key) = try!(map.next_key::<String>()) {
|
||||
while let Some(key) = map.next_key::<String>()? {
|
||||
debug!("ExtraNodesVisitor::visit_map() => key: {:?}", key);
|
||||
|
||||
if key == "__node_key" {
|
||||
debug!("ExtraNodesVisitor::visit_map() => got __node_key, getting node key");
|
||||
|
||||
let node_key: String = try!(map.next_value());
|
||||
let node_key: String = map.next_value()?;
|
||||
debug!("ExtraNodesVisitor::visit_map() => node key: {:?}", node_key);
|
||||
|
||||
extra.set_parent_key(node_key);
|
||||
continue;
|
||||
}
|
||||
|
||||
let marshal: Marshal = try!(map.next_value());
|
||||
let marshal: Marshal = map.next_value()?;
|
||||
debug!("ExtraNodesVisitor::visit_map() => marshal: {:?}", marshal);
|
||||
|
||||
let value = marshal.into_inner();
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::mem;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use node::Node;
|
||||
use crate::node::Node;
|
||||
|
||||
mod de;
|
||||
mod ser;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde::ser::{Serialize, SerializeMap};
|
||||
|
||||
use node::ExtraNodes;
|
||||
use crate::node::ExtraNodes;
|
||||
|
||||
impl Serialize for ExtraNodes {
|
||||
#[inline]
|
||||
|
||||
@@ -3,10 +3,10 @@ use std::marker::PhantomData;
|
||||
|
||||
use serde::de::{self, Deserialize, DeserializeSeed, IntoDeserializer, SeqAccess, Visitor};
|
||||
|
||||
use node::Node;
|
||||
use node::de::NodeSeed;
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::node::Node;
|
||||
use crate::node::de::NodeSeed;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum MarshalValue {
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::mem;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use value::Value;
|
||||
use crate::value::Value;
|
||||
|
||||
mod collection;
|
||||
mod definition;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde::ser::Serialize;
|
||||
|
||||
use node::Node;
|
||||
use crate::node::Node;
|
||||
|
||||
impl Serialize for Node {
|
||||
#[inline]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use compression::Compression;
|
||||
use encoding_type::EncodingType;
|
||||
use crate::compression::Compression;
|
||||
use crate::encoding_type::EncodingType;
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct Options {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use bytes::Bytes;
|
||||
|
||||
use error::Result;
|
||||
use node::NodeCollection;
|
||||
use node_types::StandardType;
|
||||
use reader::Reader;
|
||||
use crate::error::Result;
|
||||
use crate::node::NodeCollection;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::reader::Reader;
|
||||
|
||||
pub struct Printer;
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ use bytes::Bytes;
|
||||
use byteorder::{BigEndian, ReadBytesExt};
|
||||
use failure::ResultExt;
|
||||
|
||||
use byte_buffer::ByteBufferRead;
|
||||
use compression::Compression;
|
||||
use encoding_type::EncodingType;
|
||||
use error::{KbinErrorKind, Result};
|
||||
use node::{Key, NodeData, NodeDefinition};
|
||||
use node_types::StandardType;
|
||||
use sixbit::Sixbit;
|
||||
use crate::byte_buffer::ByteBufferRead;
|
||||
use crate::compression::Compression;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::{KbinErrorKind, Result};
|
||||
use crate::node::{Key, NodeData, NodeDefinition};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::sixbit::Sixbit;
|
||||
|
||||
use super::{ARRAY_MASK, SIGNATURE};
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ use byteorder::{BigEndian, WriteBytesExt};
|
||||
use failure::ResultExt;
|
||||
use serde::ser::{self, Impossible, Serialize};
|
||||
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node_types::StandardType;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node_types::StandardType;
|
||||
|
||||
pub struct BufferSerializer {
|
||||
buffer: Vec<u8>,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use serde::ser::{Serialize, SerializeTupleStruct};
|
||||
|
||||
use error::KbinErrorKind;
|
||||
use node_types::StandardType;
|
||||
use ser::{Error, Result, Serializer, TypeHint, WriteMode};
|
||||
use crate::error::KbinErrorKind;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::ser::{Error, Result, Serializer, TypeHint, WriteMode};
|
||||
|
||||
pub struct Custom<'a> {
|
||||
ser: &'a mut Serializer,
|
||||
|
||||
@@ -2,10 +2,10 @@ use byteorder::WriteBytesExt;
|
||||
use failure::ResultExt;
|
||||
use serde::ser::{Serialize, SerializeMap};
|
||||
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node_types::StandardType;
|
||||
use ser::{Result, Serializer, TypeHint, WriteMode, ARRAY_MASK};
|
||||
use sixbit::Sixbit;
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::ser::{Result, Serializer, TypeHint, WriteMode, ARRAY_MASK};
|
||||
use crate::sixbit::Sixbit;
|
||||
|
||||
pub struct Map<'a> {
|
||||
ser: &'a mut Serializer,
|
||||
|
||||
@@ -5,11 +5,11 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
||||
use failure::ResultExt;
|
||||
use serde::ser::{self, Impossible, Serialize};
|
||||
|
||||
use byte_buffer::ByteBufferWrite;
|
||||
use encoding_type::EncodingType;
|
||||
use node_types::StandardType;
|
||||
use error::{Error, KbinError, KbinErrorKind};
|
||||
use sixbit::Sixbit;
|
||||
use crate::byte_buffer::ByteBufferWrite;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::error::{Error, KbinError, KbinErrorKind};
|
||||
use crate::sixbit::Sixbit;
|
||||
use super::{ARRAY_MASK, SIGNATURE, SIG_COMPRESSED};
|
||||
|
||||
mod buffer;
|
||||
|
||||
@@ -4,9 +4,9 @@ use byteorder::{BigEndian, WriteBytesExt};
|
||||
use failure::ResultExt;
|
||||
use serde::ser::{Serialize, SerializeSeq};
|
||||
|
||||
use error::KbinErrorKind;
|
||||
use node_types::StandardType;
|
||||
use ser::{Error, Result, Serializer, TypeHint, WriteMode};
|
||||
use crate::error::KbinErrorKind;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::ser::{Error, Result, Serializer, TypeHint, WriteMode};
|
||||
|
||||
pub struct Seq<'a> {
|
||||
ser: &'a mut Serializer,
|
||||
|
||||
@@ -2,9 +2,9 @@ use byteorder::WriteBytesExt;
|
||||
use failure::ResultExt;
|
||||
use serde::ser::{Serialize, SerializeStruct};
|
||||
|
||||
use error::{Error, KbinErrorKind};
|
||||
use node_types::StandardType;
|
||||
use ser::{Result, Serializer, TypeHint, ARRAY_MASK};
|
||||
use crate::error::{Error, KbinErrorKind};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::ser::{Result, Serializer, TypeHint, ARRAY_MASK};
|
||||
|
||||
pub struct Struct<'a> {
|
||||
ser: &'a mut Serializer,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use serde::ser::{Serialize, SerializeTuple};
|
||||
|
||||
use error::KbinErrorKind;
|
||||
use node_types::StandardType;
|
||||
use ser::{Error, Result, Serializer, TypeHint};
|
||||
use ser::buffer::BufferSerializer;
|
||||
use crate::error::KbinErrorKind;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::ser::{Error, Result, Serializer, TypeHint};
|
||||
use crate::ser::buffer::BufferSerializer;
|
||||
|
||||
/// Tuple handler for serialization.
|
||||
///
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::io::{Read, Write};
|
||||
use byteorder::{ReadBytesExt, WriteBytesExt};
|
||||
use failure::ResultExt;
|
||||
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
|
||||
static CHAR_MAP: &'static [u8] = b"0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ use quick_xml::Reader;
|
||||
use quick_xml::events::{BytesStart, BytesText, Event};
|
||||
use quick_xml::events::attributes::Attributes;
|
||||
|
||||
use encoding_type::EncodingType;
|
||||
use error::{KbinErrorKind, Result};
|
||||
use node::{Key, NodeData, NodeCollection, NodeDefinition};
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::{KbinErrorKind, Result};
|
||||
use crate::node::{Key, NodeData, NodeCollection, NodeDefinition};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
pub struct TextXmlReader<'a> {
|
||||
xml_reader: Reader<&'a [u8]>,
|
||||
|
||||
@@ -2,9 +2,9 @@ use std::fmt::Write;
|
||||
|
||||
use minidom::Element;
|
||||
|
||||
use node::Node;
|
||||
use to_element::ToElement;
|
||||
use value::Value;
|
||||
use crate::node::Node;
|
||||
use crate::to_element::ToElement;
|
||||
use crate::value::Value;
|
||||
|
||||
impl ToElement for Node {
|
||||
fn to_element(&self) -> Element {
|
||||
|
||||
@@ -3,8 +3,8 @@ use std::io::{Cursor, Write};
|
||||
use quick_xml::Writer;
|
||||
use quick_xml::events::{BytesDecl, Event};
|
||||
|
||||
use encoding_type::EncodingType;
|
||||
use error::KbinError;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::KbinError;
|
||||
|
||||
mod node;
|
||||
mod node_collection;
|
||||
|
||||
@@ -5,12 +5,12 @@ use quick_xml::Writer;
|
||||
use quick_xml::events::{BytesEnd, BytesStart, BytesText, Event};
|
||||
use quick_xml::events::attributes::Attribute;
|
||||
|
||||
use encoding_type::EncodingType;
|
||||
use error::KbinError;
|
||||
use node::Node;
|
||||
use node_types::StandardType;
|
||||
use to_text_xml::ToTextXml;
|
||||
use value::Value;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::KbinError;
|
||||
use crate::node::Node;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::to_text_xml::ToTextXml;
|
||||
use crate::value::Value;
|
||||
|
||||
impl ToTextXml for Node {
|
||||
/// At the moment, a `Node` will always contain UTF-8 data.
|
||||
|
||||
@@ -5,11 +5,11 @@ use quick_xml::Writer;
|
||||
use quick_xml::events::{BytesEnd, BytesStart, BytesText, Event};
|
||||
use quick_xml::events::attributes::Attribute;
|
||||
|
||||
use encoding_type::EncodingType;
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use node::NodeCollection;
|
||||
use node_types::StandardType;
|
||||
use to_text_xml::ToTextXml;
|
||||
use crate::encoding_type::EncodingType;
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use crate::node::NodeCollection;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::to_text_xml::ToTextXml;
|
||||
|
||||
impl ToTextXml for NodeCollection {
|
||||
/// At the moment, decoding the value of a `NodeDefinition` will decode
|
||||
|
||||
@@ -4,9 +4,9 @@ use std::marker::PhantomData;
|
||||
use serde::de::{Deserialize, Deserializer, EnumAccess, Error, IntoDeserializer, SeqAccess, VariantAccess, Visitor};
|
||||
use serde::de::value::SeqDeserializer;
|
||||
|
||||
use node::Marshal;
|
||||
use node_types::StandardType;
|
||||
use value::Value;
|
||||
use crate::node::Marshal;
|
||||
use crate::node_types::StandardType;
|
||||
use crate::value::Value;
|
||||
|
||||
impl<'de> Deserialize<'de> for Value {
|
||||
#[inline]
|
||||
@@ -101,7 +101,7 @@ impl<'de> Deserialize<'de> for Value {
|
||||
let mut vec = Vec::new();
|
||||
let mut array_node_type = None;
|
||||
|
||||
while let Some(elem) = try!(seq.next_element()) {
|
||||
while let Some(elem) = seq.next_element()? {
|
||||
let elem: Value = elem;
|
||||
let node_type = elem.standard_type();
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
|
||||
use failure::{Fail, ResultExt};
|
||||
use rustc_hex::FromHex;
|
||||
|
||||
use error::{KbinError, KbinErrorKind};
|
||||
use node::Node;
|
||||
use node_types::{self, StandardType};
|
||||
use crate::error::{KbinError, KbinErrorKind};
|
||||
use crate::node::Node;
|
||||
use crate::node_types::{self, StandardType};
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "serde")] {
|
||||
@@ -20,7 +20,7 @@ cfg_if! {
|
||||
pub(crate) mod de;
|
||||
mod ser;
|
||||
|
||||
use node::de::NodeSeed;
|
||||
use crate::node::de::NodeSeed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde::ser::{Serialize, SerializeTupleStruct};
|
||||
|
||||
use value::Value;
|
||||
use crate::value::Value;
|
||||
|
||||
impl Serialize for Value {
|
||||
#[inline]
|
||||
|
||||
@@ -5,14 +5,14 @@ use failure::ResultExt;
|
||||
use minidom::Element;
|
||||
use rustc_hex::FromHex;
|
||||
|
||||
use byte_buffer::ByteBufferWrite;
|
||||
use compression::Compression;
|
||||
use error::{KbinErrorKind, Result};
|
||||
use node::{Node, NodeCollection};
|
||||
use node_types::StandardType;
|
||||
use options::Options;
|
||||
use sixbit::Sixbit;
|
||||
use value::Value;
|
||||
use crate::byte_buffer::ByteBufferWrite;
|
||||
use crate::compression::Compression;
|
||||
use crate::error::{KbinErrorKind, Result};
|
||||
use crate::node::{Node, NodeCollection};
|
||||
use crate::node_types::StandardType;
|
||||
use crate::options::Options;
|
||||
use crate::sixbit::Sixbit;
|
||||
use crate::value::Value;
|
||||
|
||||
use super::{ARRAY_MASK, SIGNATURE};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user