summaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase/src/method.rs
Commit message (Collapse)AuthorAgeFilesLines
* rpcbase: Facility for looking up RPC method informationNick Mathewson2024-08-121-2/+31
| | | | | We'll need this to refer to the names of RPC methods as visible to the caller, and to cross-reference them with their related types.
* rpc: Refactor errors part 1: a new RpcMethod trait.Nick Mathewson2024-07-251-11/+25
| | | | | It is no longer necessary to say, for every RPC method, that its error type is RpcError.
* rpcbase: Replace a TODO with a set of notes and caveatsNick Mathewson2024-07-251-7/+10
| | | | | | We have decided not to remove the "anybody can define methods" property. This commit documents the consequences, and warns extenders away from some really bad ideas.
* rpc: Tests for method name checking.Nick Mathewson2024-07-151-0/+38
|
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-171-1/+1
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Add a few "TODO RPC" notesNick Mathewson2024-05-161-0/+3
|
* RPC: Fill in documentation about invoke_specialNick Mathewson2024-05-161-2/+5
|
* RPC: Require an Error type in methods.Nick Mathewson2024-05-161-0/+5
| | | | | | | | This is needed so that we can cast special methods' return types properly. I wish I could make this optional, but Rust doesn't allow defaulting an associated type.
* Relax Serialize requirement on method outputs.Nick Mathewson2024-05-161-3/+5
| | | | | Now Methods can return anything; and only if their outputs are Serialize will they implement RpcInvocable.
* rpc: Move typetag onto subtrait of DynMethodNick Mathewson2024-05-161-14/+33
| | | | | | This will allow us to create dispatchable methods that are only invoked from inside the arti code, and are not themselves serializable.
* RPC: Enforce method name format.Nick Mathewson2024-05-141-0/+71
| | | | | | | | | | | | We need to do this carefully, since we want our system to be extensible with new namespaces. First, when we are constructing an RpcMgr, we _warn_ about any method names that are misformed. Second, we add a test in the `arti` crate to fail if any method names are invalid. This will only catch method names in crates that `arti` depends on.
* rpc: Remove a limitation on DynMethod macro.Nick Mathewson2024-05-061-6/+5
| | | | It no longer requires the user to have `typetag` in scope.
* rpc: Revise backend for dispatchable-object macro.Nick Mathewson2024-04-221-11/+0
| | | | | | | | | The trick here is to provide an `Invoker` trait, with blanket implementations for appropriate `fn(_,_,_,_?) -> _`. With this trick, we no longer need to have a `decl_rpc_invoke_fn`. This lets us discard HasConstTypeId entirely, and will let us simplify some other syntax moving forward.
* rpc: Move deftly attributes into an `rpc` namespace.Nick Mathewson2024-04-111-3/+3
|
* Refactor: remove existence of HasConstTypeId_ as a traitNick Mathewson2024-04-081-1/+12
| | | | | | | | | We don't actually need this to be a trait; we just need methods and objects to have a `CONST_TYPE_ID_` if they want to participate in the inventory-based method registry. Removing this trait makes it much simpler to declare methods and objects.
* Port many of the macros in tor-rpcbase to use derive-deftly.Nick Mathewson2024-04-041-20/+20
| | | | | | This simplifies our implementation logic in a few places, and simplifies our invocation syntax greatly. There are a few infelicities, noted in `TODO RPC` comments.
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-191-0/+36
| | | | | | | | | | | | Right now, this lets us say whether the method was unrecognized or whether the parameter type was incorrect. We'll use this to enforce correct method names later on. (I have to add another `inventory` here, since the `typetag` maintainer does not want to expose this functionality: see https://github.com/dtolnay/typetag/issues/57#issuecomment-1506106290 )
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-191-9/+39
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* tor-rpcbase: Rename cmd.rs to method.rs.Nick Mathewson2023-04-121-0/+52