New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add weak referenced type WeakAddr<A>
for actors
#188
Conversation
tests/test_address.rs
Outdated
drop(addr1); | ||
|
||
ctx.run_later(Duration::new(0, 1000), move |_, _| { | ||
match weak1.upgrade() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about assert!(weak1.upgrade().is_none(), "Should not be able to upgrade dropped WeakAddr")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
// | ||
impl<A: Actor> WeakAddressSender<A> { | ||
/// TODO | ||
pub fn upgrade(&self) -> Option<AddressSender<A>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a result instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@axos88 std::rc::Weak
does the same. And there is no other reason for a failed upgrade :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing your code made me think about addresses internals which I want to re-check before we're going ahead with it.
Otherwise it looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add please changelong entry for new type of Addr
// | ||
// | ||
impl<A: Actor> WeakAddressSender<A> { | ||
pub fn upgrade(&self) -> Option<AddressSender<A>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add doc comment
} | ||
|
||
impl<A: Actor> WeakAddr<A> { | ||
pub fn upgrade(&self) -> Option<Addr<A>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add doc comment
CHANGES.md
Outdated
@@ -1,5 +1,11 @@ | |||
# CHANGES | |||
|
|||
## [0.8.0] (2018-12-18) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it 0.7.x
for now, it is not breaking change so there is no need to increment major version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Fixes #187