Open fschutt opened 6 years ago
Also you might want to update x11-clipboard
- the new version (0.3.0-alpha
) doesn't have any breaking changes, but has way less dependencies (decreased build time).
I'd like this feature too. @fschutt, could you make a PR from this?
@fschutt I'm willing to merge this (and it looks like your clipboard_metadata.rs
is a useful component for adding typed clipboard data, e.g. images). Do you want to make the PR, or should I cherry-pick the commits from your repo?
Well, when I made the fork I basically squashed the entire history and rewrote a lot of things. Not sure how to rebase all of this without losing the history. I'm not against merging it of course, but I don't see how I could undo this without losing all of the history. @aweinstock314 I've never used cherry-picking, maybe you're better at git, so that may be an option. I'm fairly busy atm, feel free to merge my fork back in. It's just that you didn't respond for several months, so I thought this repo isn't maintained anymore, hence the fork.
It looks like the squash of the history also squashed your changes to error-handling into the initial commit of clipboard2, so there is no history to preserve. I'll adapt your error-handling code in as one commit, and the format handling in another.
Thanks for working on this! I think the issue is solved in master
, but it doesn't seem like a new version was released at crates.io, was it? When using v0.5.0
, it still seems to use the Box
error messages.
It does not look like it's fixed in master.
I've been working a bit on fixing it here: https://github.com/qwerty01/rust-clipboard
It's not that clean yet (I still have to go back and find the best practices for the way I chose to handle the error enums) and I don't have a mac to test the OSX changes, but it's at least providing an error type that is compatible with the ?
operator for windows and linux.
When I used in async function, it fails by:
error: future cannot be sent between threads safely
help: the trait `std::marker::Send` is not implemented for `dyn std::error::Error`
enum type can fix this
I've hard-forked this repository at https://github.com/fschutt/clipboard2 and changed it to return a
ClipboardError
enum. The problem withBox<Error>
is basically that it erases all type information - the library user can only get the description, which isn't of much use except for debugging.I've replaced all usage of
Box<Error>
with an error enum which is not only type-safe and more descriptive (the library use now knows why the function could fail), but also more performant (no dynamic dispatch). I'd be happy to contribute the changes back into this repo, but for now I'm using the hard fork (I'll credit your repository though, since large amounts of that repo isn't technically my code).