Fixup macro paths and remove prelude mod

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

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

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

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

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

Loading…
Cancel
Save