chaokunyang commented on PR #2737:
URL: https://github.com/apache/fory/pull/2737#issuecomment-3391366701
> @chaokunyang Handling these `clone`s requires dealing with `lifetimes`. I
spent quite a while on it but couldn’t get it to work, so I left it as is for
now. However, optimizing it after this PR shouldn’t be too difficult — using
`Arc` should be enough to solve the reference issue, right?
@urlyy You can create a new struct to manage read state:
```rust
pub struct ReadState {
pub meta_resolver: MetaReaderResolver,
meta_string_resolver: MetaStringReaderResolver,
pub ref_reader: RefReader,
}
```
And pooling this class:
```rust
struct Fory {
...,
read_context_pool: Pool<ReadState>,
}
```
For deserialize, just create ReadContext everytime from ReadState, and use
lifetime for `buffer`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]