mirror of
https://github.com/mbilker/kbinxml-rs.git
synced 2026-09-08 10:35:32 -05:00
options: EncodingOptions -> Options
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kbinxml"
|
||||
version = "0.2.3"
|
||||
version = "0.3.0"
|
||||
authors = ["Matt Bilker <me@mbilker.us>"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::fs::File;
|
||||
use std::io::{Cursor, Error as IoError, ErrorKind as IoErrorKind, Read, Write, stdout};
|
||||
|
||||
use failure::Fail;
|
||||
use kbinxml::{EncodingOptions, KbinXml};
|
||||
use kbinxml::{KbinXml, Options};
|
||||
use minidom::Element;
|
||||
use quick_xml::Writer;
|
||||
|
||||
@@ -102,7 +102,7 @@ fn main() -> std::io::Result<()> {
|
||||
let text_original = to_text(&element)?;
|
||||
display_buf(&text_original)?;
|
||||
|
||||
let options = EncodingOptions::with_encoding(encoding_original);
|
||||
let options = Options::with_encoding(encoding_original);
|
||||
let buf = KbinXml::to_binary_with_options(options, &element).map_err(display_err)?;
|
||||
compare_slice(&buf, &contents);
|
||||
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -34,7 +34,7 @@ use sixbit::{pack_sixbit, unpack_sixbit};
|
||||
// Public exports
|
||||
pub use encoding_type::EncodingType;
|
||||
pub use error::{KbinError, KbinErrorKind};
|
||||
pub use options::EncodingOptions;
|
||||
pub use options::Options;
|
||||
|
||||
const SIGNATURE: u8 = 0xA0;
|
||||
|
||||
@@ -45,7 +45,7 @@ const ARRAY_MASK: u8 = 1 << 6; // 1 << 6 = 64
|
||||
type Result<T> = StdResult<T, KbinError>;
|
||||
|
||||
pub struct KbinXml {
|
||||
options: EncodingOptions,
|
||||
options: Options,
|
||||
|
||||
offset_1: u64,
|
||||
offset_2: u64,
|
||||
@@ -54,14 +54,14 @@ pub struct KbinXml {
|
||||
impl KbinXml {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
options: EncodingOptions::default(),
|
||||
options: Options::default(),
|
||||
|
||||
offset_1: 0,
|
||||
offset_2: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_options(options: EncodingOptions) -> Self {
|
||||
pub fn with_options(options: Options) -> Self {
|
||||
Self {
|
||||
options,
|
||||
|
||||
@@ -578,7 +578,7 @@ impl KbinXml {
|
||||
kbinxml.to_binary_internal(input)
|
||||
}
|
||||
|
||||
pub fn to_binary_with_options(options: EncodingOptions, input: &Element) -> Result<Vec<u8>> {
|
||||
pub fn to_binary_with_options(options: Options, input: &Element) -> Result<Vec<u8>> {
|
||||
let mut kbinxml = KbinXml::with_options(options);
|
||||
kbinxml.to_binary_internal(input)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use encoding_type::EncodingType;
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct EncodingOptions {
|
||||
pub struct Options {
|
||||
pub(crate) encoding: EncodingType,
|
||||
}
|
||||
|
||||
impl EncodingOptions {
|
||||
impl Options {
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user