aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-rpcbase/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor: remove existence of HasConstTypeId_ as a traitNick Mathewson2024-04-081-1/+0
| | | | | | | | | 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-2/+9
| | | | | | 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.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* RPC: Functionality to downcast dyn Object to a dyn Trait.Nick Mathewson2023-06-121-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather tricky piece of functionality. It works as follows. We introduce a `CastTable` type. Each `CastTable` tells us how to downcast `dyn Object` for objects of a single concrete type. The `Object` type now has a `get_casttable` method that returns an empty `CastTable` by default. `CastTable` is, internally, a map from the `TypeId` of the target dyn Trait reference type to a function `fn(&dyn Object) -> &dyn Trait`. These functions are stored as `Box<dyn Any + ...>`. (They are Boxed because they may refer to generic functions, which you can't get a static reference to, and they're Any because the functions have different types.) The `decl_object!` macro now implements `get_casttable` as appropriate. (The syntax is a bit janky, but that's what we get for not using derive_adhoc.) For non-generic types, `get_casttable` uses a Lazy<CastTable>`. to initialize a CastTable exactly once. For generic types, it use a `Lazy<RwLock<HashMap<..>>` to build one CastTable per instantiation of the generic type. This could probably be optimized a bit more, the yaks could be shaved in a more scintillating hairstyle, and the syntax for generic `decl_object` could definitely be improved.
* rpc: Remove downgrade_owned for nowNick Mathewson2023-05-241-8/+0
| | | | | | | Rationale: Our weak-vs-strong design is a bit confused at the moment due to concerns about deduplication and capability semantics. It's not clear that a general "change strong to weak" method is compatible with what we want to provide.
* rpc: Implement functionality to remove objects from a sessionNick Mathewson2023-05-241-0/+25
| | | | | | | | | | | I've made doing some design choices here: * Reserving "rpc" as a prefix for post-authentication functionality that is not arti-specific. * Declaring these to be methods on the session rather than methods on the objects themselves. There's a problem with defining an API to drop a weak reference; see comment in code.
* rpc: fix documentation for methods in Context.Nick Mathewson2023-05-241-6/+4
|
* RPC: Add "register" methods to RequestContext.Nick Mathewson2023-05-041-0/+23
|
* rpc: Simplify and clarify SendUpdateError.Nick Mathewson2023-04-191-7/+13
|
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-191-2/+3
| | | | | | | | | | | | 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 )
* rpcbase: Use with_fn.Nick Mathewson2023-04-191-1/+3
|
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-191-1/+1
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* rpc: Move update sink out of context.Nick Mathewson2023-04-161-8/+13
| | | | | Now the update sink is its own boxed object. It is not yet passed to the invoke functions that want it.
* tor-rpcbase: Rename cmd.rs to method.rs.Nick Mathewson2023-04-121-2/+2
|
* tor-rpcbase: Rename and rephrase "command" to "method"Nick Mathewson2023-04-121-4/+4
|
* Rename tor-rpccmd to tor-rpcbase.Nick Mathewson2023-04-121-0/+113