Fixup macro paths and remove prelude mod

Signed-off-by: trivernis <trivernis@protonmail.com>
main
trivernis 3 years ago
parent 5e5b1d8f6d
commit ab11e37da0
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -15,7 +15,7 @@ been noticed yet.
## Usage
```rust
use multi_trait_object::prelude::*;
use multi_trait_object::*;
use std::fmt::Debug;
#[derive(Debug)]

@ -23,7 +23,7 @@ pub struct FatPointer {
/// A container to store data with the associated type and trait objects
/// allowing for casting down to trait_impl or the concrete type
/// ```rust
/// use multi_trait_object::prelude::*;
/// use multi_trait_object::*;
/// use std::fmt::{Debug, Display};
///
/// let mut mto = MultitraitObject::new(String::new());
@ -196,7 +196,3 @@ impl<T> From<T> for MultitraitObject where T: IntoMultitrait {
other.into_multitrait()
}
}
pub mod prelude {
pub use crate::*;
}

@ -1,7 +1,6 @@
/// Implements the `IntoMultitrait` trait on the defined type.
/// ```rust
/// use multi_trait_object::prelude::*;
///
/// use multi_trait_object::*;
/// struct MyStruct {
/// a: u64,
/// }
@ -17,11 +16,11 @@
#[macro_export]
macro_rules! impl_trait_object {
($obj:ty, $($trt:ty),*) => {
impl IntoMultitrait for $obj {
fn into_multitrait(self) -> MultitraitObject {
let mut mto = MultitraitObject::new(self);
impl $crate::IntoMultitrait for $obj {
fn into_multitrait(self) -> $crate::MultitraitObject {
let mut mto = $crate::MultitraitObject::new(self);
$(
register_traits!(mto, $obj, $trt);
$crate::register_traits!(mto, $obj, $trt);
)*
mto
@ -32,7 +31,7 @@ macro_rules! impl_trait_object {
/// Registers multiple trait_impl on a multitrait object
/// ```rust
/// use multi_trait_object::prelude::*;
/// use multi_trait_object::*;
/// use std::fmt::{Debug, Display};
///
/// let value = String::new();
@ -43,7 +42,7 @@ macro_rules! impl_trait_object {
macro_rules! register_traits {
($r:expr, $v:ty, $($t:ty), +) => {
$(
$r._register::<$t>(__fat_pointer!($v as $t).vptr);
$r._register::<$t>($crate::__fat_pointer!($v as $t).vptr);
)+
}
}
@ -55,7 +54,7 @@ macro_rules! __fat_pointer {
let x = ::std::ptr::null::<$v>() as *const $v as *const $t;
#[allow(unused_unsafe)]
unsafe {
std::mem::transmute::<_, FatPointer>(x)
std::mem::transmute::<_, $crate::FatPointer>(x)
}
}}
}

@ -1,5 +1,5 @@
use std::fmt::Debug;
use crate::prelude::*;
use crate::{__fat_pointer, impl_trait_object, IntoMultitrait, TryClone, TryPartialEq, RawClone, PartialEqAny};
#[derive(Clone, Debug, Eq, PartialEq)]
struct TestStruct {

Loading…
Cancel
Save