-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix Scheme! macro to be used from other crates #68
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was deleted when working on the Map & Array data types. See e500dc1 for more info. Before this commit `TypeMismatchError` was expecting fully qualified `Type` for the expected `member`. However when executing `Map::try_form` we only know that we expect a Map but not a Map of which specific type (same apply for Array). To overcome this issue, i thought about two different solution: * Implement custom `try_from(ty: Type)` method for Map and Array without implementing the TryFrom trait itself (because the prototype of try_from does not expect any argument) * Modify the `TypeMismatchError` type to be able to express that lack of knowledge. I chose the later: * ExpectedMismatchType::Type(Type) corresponds to a fully qualified expected type * ExpectedMismatchType::Array is used when expected an Array bot not knowing of which Type * ExpectedMismatchType::Map is used when expected a Map bot not knowing of which Type
Scheme now stores trait object that implements the FunctionDefinition trait instead of bare Function object.
Before one could return a max_arg_count lower than min_arg_count.
…onDefinition trait
* Return error directly from check_param in FunctionDefinition trait * Store a set of expected types in TypeMismatchError
The `Scheme!` macro references `crate`, but since it is a macro this will evaluate at compile time to be the crate that is attempting to use wirefilter. We must use `$crate` to force the lookup to occur in the crate defining the macro.
marmeladema
force-pushed
the
cloudflare
branch
from
September 23, 2020 14:41
3cd559d
to
2334ab1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
Scheme!
macro referencescrate
, but since it is a macro thiswill evaluate at compile time to be the crate that is attempting to use
wirefilter. We must use
$crate
to force the lookup to occur in thecrate defining the macro.