Comments (2)
FYI I dug a bit into the API and I realized I don't like the duplication around is_known
and the other methods since it can cause bugs. I think I will want to change it to something like:
struct ParamSlot<'a, 'b>(&'a mut Option<Param<'b>>);
impl<'a, 'b> ParamSlot<'a, 'b> {
pub fn param_known(self) -> Param<'b> { self.0.take() }
}
trait DeserializationState<'de>: Default {
fn deserialize_borrowed<'a>(&mut self, key: &str, value: ParamSlot<'a, 'de>) -> Result<ParamKind<'a, 'de>, (<Self::Value as DeserializationError>::Error, ParamSlot<'a, 'de>)> {
self.deserialize_temp(key, value)
}
fn deserialize_temp<'a, 'b>(&mut self, key: &str, value: ParamSlot<'a, 'b>) -> Result<ParamKind<'a, 'b>, (<Self::Value as DeserializationError>::Error, ParamSlot<'a, 'b>)>;
}
Also DeserializationError
seems to exist because of lack of GAT, so I'd love to bump MSRV eventually.
from bip21.
Damn, I saw this issue before but I couldn't react for some reason and then forgot. :(
I was hoping that writing "It's inspired by serde
" would make it obvious. We do it exactly like serde
does, with macros. We can do either declarative or procedural. I personally prefer declarative but I know many people will want procedural, so I'll be happy to see anyone contributing that.
Here's a relevant part I wrote in the silent payment issue:
The way you compose it is you define struct MyParams { payjoin: Option<PjParams>, lightning: Option<LnParams> }
(possibly Option<Result<_, _>>
instead) and make DeserializationState
contain states of both, you then try to feed the parameters into each and call finalize
of each at the end. Allowing this is also the reason for the is_param_known
method.
from bip21.
Related Issues (9)
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 bip21.