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
CowMut enum is in file cow_mut.rs and is mainly used by GreenNodeBuilder to deal with the differences of owning NodeCache or mutable reference of NodeCache. I wonder whether using trait BorrowMut is better? As trait has no runtime overhead than enum?
GreenNodeBuilder starts with a borrowed CowMut and may or may not replace it with an owned CowMut in the future. Using BorrowMut doesn't work for this as you have to commit to either a borrowed or owned value in advance.
GreenNodeBuilder starts with a borrowed CowMut and may or may not replace it with an owned CowMut in the future. Using BorrowMut doesn't work for this as you have to commit to either a borrowed or owned value in advance.
What's the meaning of "borrowed" or "owned"? Is it state of the CowMut enum?
I'm not very sure. But I did not find any state changes in CowMut and the usage in GreenNodeBuilder. It seems like that the lifetime and the state of CowMut(cache) is stabelized when GreenNodeBuilder was first created.
And I think even replace CowMut with BorrowMut does not change the future plan of "GreenNodeBuilder starts with a borrowed CowMut and may or may not replace it with an owned CowMut". As the change of the state of cache(CowMut) would reflect on the lifetime of GreenNodeBuilder?
Finally, thanks for explaining the considerations of the design. I just find it hard to capture the design of the CowMut.
I'm not very sure. But I did not find any state changes in CowMut and the usage in GreenNodeBuilder. It seems like that the lifetime and the state of CowMut(cache) is stabelized when GreenNodeBuilder was first created.
Activity
bjorn3 commentedon May 31, 2025
GreenNodeBuilder starts with a borrowed CowMut and may or may not replace it with an owned CowMut in the future. Using BorrowMut doesn't work for this as you have to commit to either a borrowed or owned value in advance.
page0egap commentedon May 31, 2025
What's the meaning of "borrowed" or "owned"? Is it state of the CowMut enum?
I'm not very sure. But I did not find any state changes in CowMut and the usage in GreenNodeBuilder. It seems like that the lifetime and the state of CowMut(cache) is stabelized when GreenNodeBuilder was first created.
page0egap commentedon May 31, 2025
And I think even replace CowMut with BorrowMut does not change the future plan of "GreenNodeBuilder starts with a borrowed CowMut and may or may not replace it with an owned CowMut". As the change of the state of cache(CowMut) would reflect on the lifetime of GreenNodeBuilder?
Finally, thanks for explaining the considerations of the design. I just find it hard to capture the design of the CowMut.
bjorn3 commentedon May 31, 2025
Looks like that is indeed the case.