File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
juniper/src/macros/helper Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ pub struct NotScalarError<'a, S: ScalarValue>(pub &'a InputValue<S>);
6262/// [Autoref-based specialized][0] coercion into a [`Result`] for a function call for providing a
6363/// return-type polymorphism in macros.
6464///
65+ /// # Priority
66+ ///
67+ /// 1. Functions returning [`Result`] are propagated "as is".
68+ ///
69+ /// 2. Any other function's output is wrapped into [`Result`] with an [`Infallible`] [`Err`].
70+ ///
6571/// [0]: https://lukaskalbertodt.github.io/2019/12/05/generalized-autoref-based-specialization.html
6672pub trait ToResultCall {
6773 /// Input of this function.
@@ -98,6 +104,18 @@ impl<I, O> ToResultCall for fn(I) -> O {
98104/// [Autoref-based specialized][0] coercion into a [`ScalarValue`] for a function call for providing
99105/// a return-type polymorphism in macros.
100106///
107+ /// # Priority
108+ ///
109+ /// 1. Functions returning a [`ScalarValue`] are propagated "as is".
110+ ///
111+ /// 2. Functions returning a [`String`] are followed by [`From<String>`] conversion.
112+ ///
113+ /// 3. Functions returning anything implementing [`ToScalarValue`] conversion are followed by this
114+ /// conversion.
115+ ///
116+ /// 4. Functions returning anything implementing [`Display`] are followed by the
117+ /// [`ScalarValue::from_displayable_non_static()`] method call.
118+ ///
101119/// [0]: https://lukaskalbertodt.github.io/2019/12/05/generalized-autoref-based-specialization.html
102120pub trait ToScalarValueCall < S : ScalarValue > {
103121 /// Input of this function.
You can’t perform that action at this time.
0 commit comments