<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/arti.git/crates/arti-client/src/client, branch arti-v1.1.6</title>
<subtitle>mirror of https://gitlab.torproject.org/tpo/core/arti
</subtitle>
<id>http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.1.6</id>
<link rel='self' href='http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.1.6'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/'/>
<updated>2023-06-12T17:35:28Z</updated>
<entry>
<title>RPC: Functionality to downcast dyn Object to a dyn Trait.</title>
<updated>2023-06-12T17:35:28Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-06-07T17:30:36Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=8166a29746b8fa7b447fc0f3929668e35c3314ae'/>
<id>urn:sha1:8166a29746b8fa7b447fc0f3929668e35c3314ae</id>
<content type='text'>
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(&amp;dyn Object) -&gt; &amp;dyn Trait`.  These functions are stored as
`Box&lt;dyn Any + ...&gt;`.  (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&lt;CastTable&gt;`. to initialize a CastTable exactly once.
For generic types, it use a `Lazy&lt;RwLock&lt;HashMap&lt;..&gt;&gt;` 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.
</content>
</entry>
<entry>
<title>rpc: make decl_object! responsible for writing impl Object {} blocks.</title>
<updated>2023-06-07T18:37:04Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-06-07T18:36:46Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=999f914e030e77d9439f0cb6910af10def33d518'/>
<id>urn:sha1:999f914e030e77d9439f0cb6910af10def33d518</id>
<content type='text'>
</content>
</entry>
<entry>
<title>RPC: Start on plumbing TorClient into our RPC code</title>
<updated>2023-05-04T14:35:03Z</updated>
<author>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</author>
<published>2023-04-20T18:17:16Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=d7ab388faf96f53e7981e8307f51a16e7891627b'/>
<id>urn:sha1:d7ab388faf96f53e7981e8307f51a16e7891627b</id>
<content type='text'>
Because of #837, we won't be able to work with _every_ TorClient&lt;R&gt;,
so I'm only going to be using TorClient&lt;PreferredRuntime&gt; for now.
</content>
</entry>
</feed>
