Comments (4)
Hi, could you please send a code example, so that I can better understand the use-case? Thanks!
from rust-delegate.
Hey! Basically every non trivial NewType or type which otherwise wraps another type, and where Id prefer to not have to instantiate the inner type and call into() on it. Being able to delegate a lot of constructors would be awesome!
from rust-delegate.
Eg the Hex32Bytes structure holding an inner BagOfBytes, would be nice ti delegate the TryFrom and From impl:
from rust-delegate.
With rust-delegate
, you can't currently delegate trait implementations, due to limitations of the Rust introspection system. You could do something like this (if it were implemented):
delegate_trait! { TryFrom, Hex32Bytes, Vec<u8>>, CommonError }
but I'm not sure if that's so much better than the hand-written impl.
from rust-delegate.
Related Issues (20)
- Delegate with additional arguments
- Transfer ownership! HOT 3
- Bridging sync to async gap with delegate HOT 5
- Allow #[from] and #[into] annotations, pattern-matching or even arbitrary transformation functions for delegated arguments HOT 10
- allow #[try_from] and #[try_into] HOT 8
- Is delegating to enum in the target range HOT 4
- Compatability with async_trait HOT 2
- Just unwrap HOT 3
- Assign Return Value Of Delegated Calls To Delegated Field HOT 7
- Add attribute to the return value of all methods HOT 4
- Add support support for qualified calls HOT 6
- Delegate to Self HOT 1
- transform the return value of `Result` and `Option` type HOT 8
- New release? HOT 1
- Change default inlining mode
- `no_std` support HOT 3
- Re-use documentation from delegated method HOT 2
- Support for delagating to enum variants with different inner type and `#[into]` modifier. HOT 6
- forwarding docs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-delegate.