You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Arc<One> as input, and want to provide something as if Arc<Two> as output, but it should have no lifetime specifier by putting Arc<One> inside it.
// pseudo code for both self_cell and ouroborosstructTwoWithOwner{one:Arc<One>,two:Two<'this>,}let input:Arc<One> = ...;let output:Arc<TwoWithOwner> = Arc::new(TwoWithOwnerBuilder{one: input,two_builder: |one| compute(one),}.build());
Now comes the problem. Suppose the return type is a Vec:
fncompute(one:&'a One) -> Vec<Two<'a>>{ .. }
And for the same input, I hope to provide Vec<Arc<Two>> as output (again without lifetimes).
If using the exact same code, I will only get something like:
In other words, an Arc<VecTwoWithOwner> object, instead of Vec<Arc<TwoWithOwner>>.
It would be great if there are some API that can split an Arc<VecTwoWithOwner> object into multiple Vec<Arc<TwoWithOwner>> objects. From my naive thoughts, maybe there can be something like a transform function. Or, there may be better solutions for the scenario above.
Hi thanks for the helpful package!
When implementing https://github.com/fzyzcjy/flutter_rust_bridge, I am considering the following scenario. Firstly a simple one:
I have a
Arc<One>
as input, and want to provide something as ifArc<Two>
as output, but it should have no lifetime specifier by puttingArc<One>
inside it.Now comes the problem. Suppose the return type is a
Vec
:And for the same input, I hope to provide
Vec<Arc<Two>>
as output (again without lifetimes).If using the exact same code, I will only get something like:
In other words, an
Arc<VecTwoWithOwner>
object, instead ofVec<Arc<TwoWithOwner>>
.It would be great if there are some API that can split an
Arc<VecTwoWithOwner>
object into multipleVec<Arc<TwoWithOwner>>
objects. From my naive thoughts, maybe there can be something like atransform
function. Or, there may be better solutions for the scenario above.Cross-posted in: Voultapher/self_cell#58
The text was updated successfully, but these errors were encountered: