1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// /// The input to a procedure which is derived from an [`ProcedureInput`](crate::procedure::Argument).
// ///
// /// This trait has a built in implementation for any type which implements [`DeserializeOwned`](serde::de::DeserializeOwned).
// ///
// /// ## How this works?
// ///
// /// [`Self::from_value`] will be provided with a [`ProcedureInput`] which wraps the [`Argument::Value`](super::Argument::Value) from the argument provided to the [`Procedure::exec`](super::Procedure) call.
// ///
// /// Input is responsible for converting this value into the type the user specified for the procedure.
// ///
// /// If the type implements [`DeserializeOwned`](serde::de::DeserializeOwned) we will use Serde, otherwise we will attempt to downcast the value.
// ///
// /// ## Implementation for custom types
// ///
// /// Say you have a type `MyCoolThing` which you want to use as an argument to an rspc procedure:
// ///
// /// ```
// /// pub struct MyCoolThing(pub String);
// ///
// /// impl ResolverInput for MyCoolThing {
// /// fn from_value(value: ProcedureInput<Self>) -> Result<Self, InternalError> {
// /// Ok(todo!()) // Refer to ProcedureInput's docs
// /// }
// /// }
// ///
// /// // You should also implement `ProcedureInput`.
// ///
// /// fn usage_within_rspc() {
// /// <Procedure>::builder().query(|_, _: MyCoolThing| async move { () });
// /// }
// /// ```
// TODO: Should this be in `rspc_procedure`???
// TODO: Maybe rename?
use DeserializeOwned;
use ;
/// TODO: Restore the above docs but check they are correct