-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor JsonLdOptions to take document loader factory instead of loader #151
Conversation
thanks a lot @damooo . A few questions:
|
Yes. I first considered that approach. But there arised an issue with sophia_rs/resource/src/loader/_trait.rs Lines 57 to 68 in 0c38774
That is, there seems also cases, where the closure-loader captures Also, there was still a possibility to not introduce a trait, but then we have to propagate lifetime generic all the way from jsonld-options to jsonld-parser, jsonld-serializer. That seems a bit disruptive. You can see that approach tried in this branch. The trait will stop such lifetime propagation with a GAT. Also trait removes the need to articulate many-many bounds on sophia_rs/jsonld/src/parser.rs Lines 64 to 73 in 0c38774
LF .
Essentially, only
Closure factory added to properly support lending-factory-closures. I thought It will be parallel to design of existing |
all this makes a lot of sense, you convinced me :) May I suggest, however, to change the signature of (and people could still pass SomeLoader::default if they want -- it does not really matter at this point whether we use |
They are not the only ones? For example i will be using a named struct called Could we have a seperate method instead? Also, it may be useful if we also provide named struct |
You could still pass the following closure: move || templateLoader.clone() and get exactly the same result, couldn't you? |
Yes, but what if we want to "name" the concrete type for generic? for type of a field in a struct? For example, a struct, that includes parser field in it like following: struct SomeConfig {
jsonld_parser: JsonLdParser<CloningLoaderFactory<CachingHttpLoader>>,
a: String,
b: u32,
} If we use |
That's right, you convinced again :) |
_/\_ |
Addresses #143