Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove FnBox since it's deprecated #8

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are two ways to (de)serialize your trait object:

Additionally, there are several convenience traits implemented that extend their stdlib counterparts:

* [Any](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Any.html), [Debug](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Debug.html), [Display](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Display.html), [Error](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Error.html), [Fn](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Fn.html), [FnBox](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.FnBox.html), [FnMut](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.FnMut.html), [FnOnce](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.FnOnce.html)
* [Any](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Any.html), [Debug](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Debug.html), [Display](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Display.html), [Error](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Error.html), [Fn](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.Fn.html), [FnMut](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.FnMut.html), [FnOnce](https://docs.rs/serde_traitobject/0.1.3/serde_traitobject/trait.FnOnce.html)

These are automatically implemented on all implementors of their stdlib counterparts that also implement `serde::Serialize` and `serde::de::DeserializeOwned`.

Expand Down
18 changes: 0 additions & 18 deletions src/convenience.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,6 @@ impl<T: Serialize + Deserialize + fmt::Display + ?Sized> fmt::Display for Box<T>
self.0.fmt(f)
}
}
impl<'a, A, R> ops::FnOnce<A> for Box<dyn FnBox<A, Output = R> + 'a> {
type Output = R;
extern "rust-call" fn call_once(self, args: A) -> R {
self.0.call_box(args)
}
}
impl<'a, A, R> ops::FnOnce<A> for Box<dyn FnBox<A, Output = R> + Send + 'a> {
type Output = R;
extern "rust-call" fn call_once(self, args: A) -> R {
self.0.call_box(args)
}
}
impl<T: Serialize + Deserialize + ?Sized + 'static> serde::ser::Serialize for Box<T> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down Expand Up @@ -494,12 +482,6 @@ impl<T: ?Sized> Debug for T where T: fmt::Debug + Serialize + Deserialize {}
pub trait FnOnce<Args>: ops::FnOnce<Args> + Serialize + Deserialize {}
impl<T: ?Sized, Args> FnOnce<Args> for T where T: ops::FnOnce<Args> + Serialize + Deserialize {}

/// A convenience trait implemented on all (de)serializable implementors of [std::boxed::FnBox].
///
/// It can be made into a trait object which is then (de)serializable.
pub trait FnBox<Args>: boxed::FnBox<Args> + Serialize + Deserialize {}
impl<T: ?Sized, Args> FnBox<Args> for T where T: boxed::FnBox<Args> + Serialize + Deserialize {}

/// A convenience trait implemented on all (de)serializable implementors of [std::ops::FnMut].
///
/// It can be made into a trait object which is then (de)serializable.
Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//!
//! Additionally, there are several convenience traits implemented that extend their stdlib counterparts:
//!
//! * [Any], [Debug], [Display], [Error], [Fn], [FnBox], [FnMut], [FnOnce]
//! * [Any], [Debug], [Display], [Error], [Fn], [FnMut], [FnOnce]
//!
//! These are automatically implemented on all implementors of their stdlib counterparts that also implement `serde::Serialize` and `serde::de::DeserializeOwned`.
//!
Expand Down Expand Up @@ -107,7 +107,6 @@
unsize,
specialization,
trivial_bounds,
fnbox
)]
#![warn(
missing_copy_implementations,
Expand Down