Skip to content

Commit

Permalink
remove dummy code & update version to 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zTgx committed Apr 12, 2020
1 parent c9d3e4b commit cd930c4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
3 changes: 1 addition & 2 deletions examples/downcast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Import macro via `macro_use` pre-1.30.

extern crate cast_rs;
use cast_rs::downcast::*;
use cast_rs::downcast_rs::*;

// To create a trait with downcasting methods, extend `Downcast` and run
// `impl_downcast!()` on the trait.
Expand Down
13 changes: 4 additions & 9 deletions examples/hex.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use cast_rs::hexcast;
use cast_rs::hex;

fn main() {
assert_eq!(
hexcast::decode("48656c6c6f20776f726c6421"),
Ok("Hello world!".to_owned().into_bytes())
);

assert_eq!(hexcast::encode(vec![1, 2, 3, 15, 16]), "0102030f10");

assert_eq!(hexcast::encode("Hello world!"), "48656c6c6f20776f726c6421");
assert_eq!(hex::decode("48656c6c6f20776f726c6421"), Ok("Hello world!".to_owned().into_bytes()));
assert_eq!(hex::encode(vec![1, 2, 3, 15, 16]), "0102030f10");
assert_eq!(hex::encode("Hello world!"), "48656c6c6f20776f726c6421");
}
4 changes: 2 additions & 2 deletions examples/slicecast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use cast_rs::slicecast;
use cast_rs::slice_cast;

fn main() {
let foo: [u8; 4] = [1, 0, 0, 0];
let bar: &u32 = unsafe { slicecast::cast_to(&foo) };
let bar: &u32 = unsafe { slice_cast::cast_to(&foo) };
println!("{}", bar);
}
18 changes: 3 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
extern crate hex;
extern crate downcast_rs;
extern crate slice_cast;

pub mod hexcast {
pub use hex::*;
}

pub mod downcast {
pub use downcast_rs::*;
}

pub mod slicecast {
pub use slice_cast::*;
}
pub use hex;
pub use downcast_rs;
pub use slice_cast;

0 comments on commit cd930c4

Please sign in to comment.