From 4f62caf654b1a40e877a2c07a5b1ecb1ceaa0b50 Mon Sep 17 00:00:00 2001 From: Jason Travis Smith Date: Wed, 24 Aug 2016 13:23:56 -0400 Subject: [PATCH] Removed the Cargo.lock file from the repo and made Sigils a feature. The Sigils library will now only be compiled in and able to convert math structures if the convert_sigils feature is selected. use_std would have also been set as a feature, but the library heavily uses std::collections::vec::Vec. Until a non-std version of a collection has been written, then this needs to be used. --- .gitignore | 2 +- Cargo.lock | 53 --------------------------------------------- Cargo.toml | 13 ++++++----- src/lib.rs | 5 ++++- src/transmutable.rs | 7 ++++++ 5 files changed, 20 insertions(+), 60 deletions(-) delete mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 48f68fb..3853ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ # Remove Cargo.lock from gitignore if creating an executable, # leave it for libraries. # More information here: http://doc.crates.io/guide.html#cargotoml-vs-cargolock -#Cargo.lock +Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index e91a898..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,53 +0,0 @@ -[root] -name = "alchemy" -version = "0.1.0" -dependencies = [ - "rand 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", - "scribe 0.1.0 (git+https://gitlab.com/CyberMages/scribe.git)", - "sigils 0.1.0 (git+https://gitlab.com/CyberMages/sigils.git)", -] - -[[package]] -name = "advapi32-sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libc" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rand" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scribe" -version = "0.1.0" -source = "git+https://gitlab.com/CyberMages/scribe.git#e52418d3bfc28cd1f03cc7f31af06fce2e03f844" - -[[package]] -name = "sigils" -version = "0.1.0" -source = "git+https://gitlab.com/CyberMages/sigils.git#e64c3b0fbecca351e0a078fefc4273a0f0b8e6ad" - -[[package]] -name = "winapi" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - diff --git a/Cargo.toml b/Cargo.toml index 8abf649..cc2c89b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,14 @@ documentation = "" keywords = ["converter", "binary"] -[dependencies.scribe] -git = "https://gitlab.com/CyberMages/scribe.git" +[features] +default = [] +convert_sigils = ["sigils"] -[dependencies.sigils] -git = "https://gitlab.com/CyberMages/sigils.git" +[dependencies] +scribe = { git = "https://gitlab.com/CyberMages/scribe.git" } + +sigils = { optional = true, git = "https://gitlab.com/CyberMages/sigils.git" } [dev-dependencies] -rand = "*" +rand = { version = "*" } diff --git a/src/lib.rs b/src/lib.rs index 19d558e..be32931 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,15 +1,18 @@ //! The Alchemy library is a data type to byte converter library. //! Alchemy handles converting numbers to and from bytes //! in either big or little endian format. -#![doc(html_logo_url="http://cybermagesllc.com/wp-content/uploads/2012/06/logo-300x300.png", +#![doc(html_logo_url="", html_favicon_url="http://cybermagesllc.com/favicon.ico", html_root_url="http://cybermagesllc.com")] #![feature(associated_consts)] #![warn(missing_docs)] + + #[macro_use] extern crate scribe; +#[cfg(feature="sigils")] extern crate sigils; diff --git a/src/transmutable.rs b/src/transmutable.rs index befa01d..eb56bd8 100644 --- a/src/transmutable.rs +++ b/src/transmutable.rs @@ -1,5 +1,8 @@ +#[cfg(feature="convert_sigils")] use sigils::{Zero, Number, Real}; +#[cfg(feature="convert_sigils")] use sigils::vector::{Vector, Vector2, Vector3, Vector4}; +#[cfg(feature="convert_sigils")] use sigils::quaternion::Quaternion; use ::byte_sized::{ByteSized, get_byte_size_of_string}; @@ -552,6 +555,7 @@ impl Transmutable for String } } +#[cfg(feature="convert_sigils")] impl Transmutable for Vector2 where T: Number + ByteSized + Transmutable { fn from_bytes(buffer: &[u8], endianess: Endianess) -> Vector2 @@ -605,6 +609,7 @@ impl Transmutable for Vector2 where T: Number + ByteSized + Transmutable } } +#[cfg(feature="convert_sigils")] impl Transmutable for Vector3 where T: Number + ByteSized + Transmutable { fn from_bytes(buffer: &[u8], endianess: Endianess) -> Vector3 @@ -660,6 +665,7 @@ impl Transmutable for Vector3 where T: Number + ByteSized + Transmutable } } +#[cfg(feature="convert_sigils")] impl Transmutable for Vector4 where T: Number + ByteSized + Transmutable { fn from_bytes(buffer: &[u8], endianess: Endianess) -> Vector4 @@ -717,6 +723,7 @@ impl Transmutable for Vector4 where T: Number + ByteSized + Transmutable } } +#[cfg(feature="convert_sigils")] impl Transmutable for Quaternion where T: Real + ByteSized + Transmutable {